classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] Thread.sleep() update


From: Archie Cobbs
Subject: Re: [cp-patches] Thread.sleep() update
Date: Thu, 30 Dec 2004 11:07:07 -0600
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129

Jeroen Frijters wrote:
>>On Thu, 2004-12-30 at 15:53 +0100, Jeroen Frijters wrote:
>>
>>>I don't like this "fix", in particular it breaks 
>>
>>compatibility with Sun.
>>
>>>On the JDK Thread.Sleep(0) is equivalent to a yield() (i.e. 
>>
>>it doesn't
>>
>>>throw an InterruptedException, even if an interrupt is pending).
>>
>>Interesting. That was not how I would interpret the behavour 
>>of sleep().
>>Are you sure this isn't a bug in that JDK implementation? It 
>>is kind of confusing that Thread.sleep() not always throws an 
>>InterruptedException when the Thread actually was interrupted.
>>Do you have any documentation that supports this?
> 
> 
> It isn't spec'ed this way. I actually think it is a Windows peculiarity
> that shines through.

I get the same behavior (no exception thrown) on FreeBSD and Linux
with JDK 1.4.2.

So Sun has a bug - either in their implementation or their documentation.

>>>Can't the broken VMs just fix their VMThread.sleep?
>>
>>If you say that sleep(0) should call yield() then we should 
>>probably do that instead of checking whether the Thread was
>>interrupted() to make the VMThread interface as simple as possible.
> 
> I would be in favor of letting the VM implementer decide such things.
> Thread.sleep(0) is by it's very nature a very platform specific thing to
> do.

That seems completely against the whole idea of Java semantic uniformity.
I disagree and think we should pick an "interpretation" and then stick with it.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com


*
Confidentiality Notice: This e-mail message, including any attachments, is for 
the sole use of the intended recipient(s) and may contain confidential and 
privileged information. Any unauthorized review, use, disclosure or 
distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply e-mail and destroy all copies of 
the original message.
*





reply via email to

[Prev in Thread] Current Thread [Next in Thread]