libgcj/1456: wait(timeout) always throws exception
mike@pillim.demon.co.uk
mike@pillim.demon.co.uk
Wed Dec 20 12:28:00 GMT 2000
>Number: 1456
>Category: libgcj
>Synopsis: wait(timeout) always throws exception
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: tromey
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 20 12:20:08 PST 2000
>Closed-Date: Mon Oct 25 16:48:34 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 call wait with a timeout, and the timeout expires,
then you get an IllegalMonitorStateException. This is
because java::lang::Object::wait interprets the ETIMEDOUT
response as an error.
The code attached works fine under Sun JDK 1.2.1, and causes
the exception with libgcj
>How-To-Repeat:
public class TestWait{
public static void main(String[] args) {
(new Doit()).doit();
}
}
class Doit {
public synchronized void doit() {
for (int i = 0; i < 10; i++) {
System.out.println("i is now "+i);
try {wait(100);
} catch (InterruptedException e) {}
}
}
}
>Fix:
In posix-threads.cc
method _Jv_CondWait (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu,
jlong millis, jint nanos)
after the "r = pthread_cond_timedwait (cv, pmu, &ts);" line
add the following:-
/*
* Timeouts shouldn't be reported as an error.
*/
if (r == ETIMEDOUT) {
r = 0;
}
>Release-Note:
>Audit-Trail:
Formerly PR java.lang/76
From: Bryce McKinlay <bryce@albatross.co.nz>
To: mike@pillim.demon.co.uk
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: java.lang/76: wait(timeout) always throws exception
Date: Mon, 25 Oct 1999 21:43:25 +1300
Mike,
Both this bug and java.lang/77 are already fixed in cvs/snapshot
releases of libgcj.
regards
[ bryce ]
mike@pillim.demon.co.uk wrote:
> >Number: 76
> >Category: java.lang
> >Synopsis: wait(timeout) always throws exception
> >Confidential: no
> >Severity: serious
> >Priority: medium
> >Responsible: tromey
> >State: open
> >Class: sw-bug
> >Submitter-Id: net
> >Arrival-Date: Sun Oct 24 03:16:00 PDT 1999
> >Closed-Date:
> >Last-Modified:
> >Originator: Mike Moreton
> >Release: libgcj-2.95.1
> >Organization:
> >Environment:
> linux, posix threads
> >Description:
> If you call wait with a timeout, and the timeout expires,
> then you get an IllegalMonitorStateException. This is
> because java::lang::Object::wait interprets the ETIMEDOUT
> response as an error.
>
> The code attached works fine under Sun JDK 1.2.1, and causes
> the exception with libgcj
> >How-To-Repeat:
> public class TestWait{
> public static void main(String[] args) {
> (new Doit()).doit();
> }
>
> }
>
> class Doit {
> public synchronized void doit() {
> for (int i = 0; i < 10; i++) {
> System.out.println("i is now "+i);
> try {wait(100);
> } catch (InterruptedException e) {}
> }
> }
>
> }
> >Fix:
> In posix-threads.cc
> method _Jv_CondWait (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu,
> jlong millis, jint nanos)
> after the "r = pthread_cond_timedwait (cv, pmu, &ts);" line
> add the following:-
>
> /*
> * Timeouts shouldn't be reported as an error.
> */
> if (r == ETIMEDOUT) {
> r = 0;
> }
> >Release-Note:
> >Audit-Trail:
> >Unformatted:
State-Changed-From-To: open->closed
State-Changed-By: bryce
State-Changed-When: Mon Oct 25 16:48:34 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/76
Date: 25 Oct 1999 23:48:34 -0000
Synopsis: wait(timeout) always throws exception
State-Changed-From-To: open->closed
State-Changed-By: bryce
State-Changed-When: Mon Oct 25 16:48:34 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=76
>Unformatted:
More information about the Gcc-prs
mailing list