public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libgcj/1457: sleep(0) sleeps forever
@ 2000-12-20 12:28 mike
0 siblings, 0 replies; only message in thread
From: mike @ 2000-12-20 12:28 UTC (permalink / raw)
To: java-gnats
>Number: 1457
>Category: libgcj
>Synopsis: sleep(0) sleeps forever
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: tromey
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 20 12:20:09 PST 2000
>Closed-Date: Mon Oct 25 16:49:32 PDT 1999
>Last-Modified: Mon Oct 25 16:50:00 PDT 1999
>Originator: Mike Moreton
>Release: libgcj-2.95.1
>Organization:
>Environment:
Linux, posix threads
>Description:
If you run the progam attached in the "How-to-repeat"
section, the behavious is different under the Sun JDK and
libgcj.
Under Sun JDK 1.2.1, it's clear that sleep(0) means "sleep
for a very short time", while with libgcj the thread sleeps
until interrupted.
>How-To-Repeat:
public class TestSleep{
public static void main(String[] args) {
(new Doit()).start();
}
}
class Doit extends Thread{
public synchronized void run() {
for (int i = 0; i < 10; i++) {
System.out.println("i is now "+i);
try {
if (i==5) {
sleep(0);
} else {
sleep(1000);
}
} catch (InterruptedException e) {}
}
}
}
>Fix:
In natThread.cc, in method java::lang::Thread::sleep (jlong millis, jint nanos)
add at the start of the method the following code
if ((millis == 0) && (nanos == 0)) {
return;
}
>Release-Note:
>Audit-Trail:
Formerly PR java.lang/77
State-Changed-From-To: open->closed
State-Changed-By: bryce
State-Changed-When: Mon Oct 25 16:49:32 1999
State-Changed-Why:
Known bug in libgcj 2.95.x, already fixed in cvs and snapshot releases.
From: bryce@albatross.co.nz
To: java-gnats@sourceware.cygnus.com, mike@pillim.demon.co.uk,
tromey@cygnus.com
Cc:
Subject: Re: java.lang/77
Date: 25 Oct 1999 23:49:32 -0000
Synopsis: sleep(0) sleeps forever
State-Changed-From-To: open->closed
State-Changed-By: bryce
State-Changed-When: Mon Oct 25 16:49:32 1999
State-Changed-Why:
Known bug in libgcj 2.95.x, already fixed in cvs and snapshot releases.
http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&database=java&pr=77
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-12-20 12:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-20 12:28 libgcj/1457: sleep(0) sleeps forever mike
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).