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: Grzegorz B. Prokopski
Subject: RE: [cp-patches] Thread.sleep() update
Date: Thu, 30 Dec 2004 11:47:28 -0500

On Thu, 2004-30-12 at 16:26 +0100, Jeroen Frijters wrote:
> 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.

I do not think letting each VM implement its own, differently broken
handling of sleep() is the right way to go.  Especially if it would
make VM interface underspecified and more complicated.

In particular, even if Sun has different behaviours on different
platforms, we should regard it as a serious bug in Sun's implementation
and choose something sensible for GNU Classpath implementation (ie. to
make sleep(0) act as sleep(0) acts on UNIX/POSIX/Linux systems).

Cheers,

                        Grzegorz B. Prokopski

-- 
Grzegorz B. Prokopski           <address@hidden>
SableVM - Free, LGPL'ed Java VM  http://sablevm.org
Why SableVM ?!?                  http://sablevm.org/wiki/Features
Debian GNU/Linux - the Free OS   http://www.debian.org






reply via email to

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