From owner-freebsd-java@FreeBSD.ORG Thu Jun 3 17:43:27 2004 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 03F6D16A4CE for ; Thu, 3 Jun 2004 17:43:26 -0700 (PDT) Received: from smtp19.wxs.nl (smtp19.wxs.nl [195.121.6.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7280243D41 for ; Thu, 3 Jun 2004 17:43:26 -0700 (PDT) (envelope-from ronald-freebsd7@klop.yi.org) Received: from ronald.echteman.nl (ip51cdc5d2.adsl-surfen.hetnet.nl [81.205.197.210]) by smtp19.wxs.nl (iPlanet Messaging Server 5.2 HotFix 1.25 (built Mar 3 2004)) with SMTP id <0HYR006VGDZZKV@smtp19.wxs.nl> for java@freebsd.org; Fri, 04 Jun 2004 02:43:11 +0200 (CEST) Received: (qmail 18084 invoked from network); Fri, 04 Jun 2004 00:43:24 +0000 Received: from unknown (HELO laptop.thuis.klop.ws) (192.168.1.4) by ronald.echteman.nl with SMTP; Fri, 04 Jun 2004 00:43:24 +0000 Received: (qmail 6714 invoked from network); Fri, 04 Jun 2004 00:43:24 +0000 Received: from unknown (HELO guido.thuis.klop.ws) (192.168.0.2) by 192.168.0.16 with SMTP; Fri, 04 Jun 2004 00:43:24 +0000 Received: (qmail 11771 invoked from network); Fri, 04 Jun 2004 00:43:22 +0000 Received: from localhost.thuis.klop.ws (HELO outgoing.local) (127.0.0.1) by localhost.thuis.klop.ws with SMTP; Fri, 04 Jun 2004 00:43:22 +0000 Date: Fri, 04 Jun 2004 02:43:21 +0200 From: Ronald Klop In-reply-to: <16575.44523.933426.867439@emerger.yogotech.com> To: Nate Williams Message-id: MIME-version: 1.0 Content-type: text/plain; format=flowed; delsp=yes; charset=iso-8859-1 Content-transfer-encoding: 7BIT User-Agent: Opera M2/7.50 (FreeBSD, build 673) References: <20040601154601.0869f5b4@psych.iad.vt.edu> <40BD7C06.5050205@noc.ntua.gr> <20040602095245.48cb3c44@psych.iad.vt.edu> <20040603120810.096a1975@psych.iad.vt.edu> <16575.44523.933426.867439@emerger.yogotech.com> cc: java@freebsd.org Subject: Re: possible threading problem X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2004 00:43:27 -0000 On Thu, 3 Jun 2004 17:02:03 -0600, Nate Williams wrote: > [ Note, I have not analyzed the code in question, but from the sounds of > things, the behavior the posted is probably 'acceptable' on FreeBSD. ] > >> BTW: You interrupt your own thread. The javadoc's say that if the thread >> is not blocked it will set the interrupted flag. I think that the next >> time a blocking syscall is done the InterruptedIOException is thrown, >> because the interrupted flag is set. So the InterruptedIOException can >> be >> thrown at a very different moment than that the thread.interrupt() call >> was done. > > This is right on the money. Different threading models will behave very > differently. Prior to JDK1.4 on Solaris (the reference platform), you > could get *very* different results by choosing to use green threads > vs. native threads. And, things got even more different when you > started using a JIT, which could cause behavior that appeared to be > non-deterministic. > > In every good Java book, the use of 'interrupt', 'stop', and any other > method stats that the results you get *WILL* be different. Just because > one platform behaves a particular way doesn't necessarily mean it's > correct (or that any platform is correct). > >> I'm not sure about this, because I don't know enough about the >> internals of java, but it can be the reason, that it looks like a >> synchronization problem. > > In the JVM, or in the code? (I'm guessing the latter, but I want to > make sure of your intent). Yes, I mean the code. And with 'looks like' I mean that it isn't, but it makes you think it is a problem in the synchronization. I'll explain: If somebody thinks that interrupt() and the InterruptedIOException are occuring at the same moment, but the stacktrace of the exception shows the program is executing in a part which can never happen at the same moment as the interrupt() call (because of synchronized blocks) I can understand that somebody gets the idea that synchronization isn't working well. Greetings, Ronald. -- Ronald Klop, Amsterdam, The Netherlands