From owner-freebsd-java@FreeBSD.ORG Wed May 19 18:53:25 2010 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2AA31065676 for ; Wed, 19 May 2010 18:53:25 +0000 (UTC) (envelope-from mmmocra9@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 871138FC12 for ; Wed, 19 May 2010 18:53:25 +0000 (UTC) Received: by wye20 with SMTP id 20so894867wye.13 for ; Wed, 19 May 2010 11:53:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=D132DKK8ae41/OE6c3UwoTkYBWB3UT0tYkEud3m3wyU=; b=cOwJQ6RP2Yw8K1hDv0/rPZAR7lHQtKV00qWVLkVzAypyzGg3nWMRgbHEU2LxAikaOs S7/tVfMbmjX2n0eEWiSqtGaqvAekfpLqUQRuX/jkz65uO2hOaszOf034LW0iFmNuw+wG AGn/4DSykpyLDG3t6ErVAGiEOpifJjCzEj8jM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=uRBQ526lqJ4uqmRTro5cTOdzQlQD9NrWVce2NmbF9G1X/hJk0MqQrrOlahQS3lvaW4 rNwWKUjAwwFFT30HAp0E4gh+gwhZTMtFjHwZjbNMgrTViQ5LBqfEnN888fBsiI6uaWB4 z+KoEEzDERN+BVsZXhTdT5tZINmoCEw8nEGKw= MIME-Version: 1.0 Received: by 10.227.127.148 with SMTP id g20mr8139913wbs.192.1274293472454; Wed, 19 May 2010 11:24:32 -0700 (PDT) Received: by 10.227.69.212 with HTTP; Wed, 19 May 2010 11:24:32 -0700 (PDT) Date: Wed, 19 May 2010 20:24:32 +0200 Message-ID: From: mocra Moc To: freebsd-java@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: diablo 1.6.0_07-b02, threads/interrupt X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2010 18:53:26 -0000 hello, i think there is something like a bug in diablo-jdk 1.6.0_07-b02 with threads/interrupt following example should print something like there is a life before death.. active... active... active... active... interrupt in sleep() end but unfortunately, the program stops within the catch-block public class ThreadTest { public static void main(String[] args) { Thread t = new Thread() { public void run() { System.out.println( "there is a life before death.." ); while (!isInterrupted() ) { System.out.println( "active..." ); try { Thread.sleep( 500 ); } catch ( InterruptedException e ) { interrupt(); System.out.println( "interrupt in sleep()" ); } } System.out.println( "end" ); } }; t.start(); try { Thread.sleep( 2000 ); } catch (InterruptedException e) {} t.interrupt(); } } but the output is: there is a life before death.. active... active... active... active... so, IMO there is sum bug in interrupt()/isInterrupted(). within the catch-block the interrupt-flag is set to false, so you have to set it manually by interrupt(), but the program stops after interrupt() without printing neither "interrupt in sleep" nor "end" my system: FreeBSD 8.0-RELEASE-p2 (i386) java version "1.6.0_07" Diablo Java(TM) SE Runtime Environment (build 1.6.0_07-b02) Diablo Java HotSpot(TM) Server VM (build 10.0-b23, mixed mode) also tried with another FreeBSD machine, with diablo-1.6.0_07-b02 too - doesn't work works fine on a fedora system with Java(TM) SE Runtime Environment (build 1.6.0_18-b07)