[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 16:26:05 +0100 |
Mark Wielaard 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.
> > 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. I don't think that Thread.sleep() should be messing with the
arguments at all. Making things "simpler" is often not worth it in the
long run.
Regards,
Jeroen