[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [cp-patches] Thread.sleep() update
From: |
Jeroen Frijters |
Subject: |
RE: [cp-patches] Thread.sleep() update |
Date: |
Thu, 30 Dec 2004 15:53:11 +0100 |
Mark Wielaard wrote:
> Some runtimes (most notably kaffe after they merged in our Thread
> implementation [it was correct before that, oops...]) would interpret
> sleep(0) to sleep forever. This came from a copy/paste error in our
> sleep() documentation. It was based on the language in the JLS1 book
> which used the same language to descripe join() and sleep(). I have
> updated the documentation and implementation to follow how the JCL2v1
> book describes the behavour of Thread.sleep(). I also added a
> couple of
> test to Mauve (gnu.testlet.java.lang.Thread.sleep). These tests depend
> on my interpretation of Thread.sleep() throwing InterruptedException
> when the Thread was interrupted (and the interrupted flag wasn't yet
> cleared). This seems to be how gcj and kaffe also interpret
> it (but not how jamvm does it).
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).
Can't the broken VMs just fix their VMThread.sleep?
Regards,
Jeroen