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: Mark Wielaard
Subject: RE: [cp-patches] Thread.sleep() update
Date: Thu, 30 Dec 2004 16:18:42 +0100

Hi,

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?

> 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. We should have never
called VMThread.sleep() when it has a zero argument. It makes the work
that needs to be done by the runtime more complex. But most importantly
we need to document clearly what the expected behavior of
VMThread.sleep() actually is if we cannot get the semantics right in
Thread.sleep() itself.

Cheers,

Mark

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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