libgcj/289
Tom Tromey
tromey@cygnus.com
Sun Sep 10 22:16:00 GMT 2000
The following reply was made to PR libgcj/289; it has been noted by GNATS.
From: Tom Tromey <tromey@cygnus.com>
To: osk@hem.passagen.se
Cc: Java Gnats Server <java-gnats@sourceware.cygnus.com>
Subject: libgcj/289
Date: 10 Sep 2000 23:18:22 -0600
I've investigated this some more.
I experimented with the JDK. With the JDK interpreter, if the main
thread throws an uncaught exception and then exits (because that was
the last thread) then the runtime with exit with status 1.
But consider the appended program. This program attempts to determine
what happens if the main thread throws an exception but is not the
last thread to stop. In this situation, what should happen? I don't
know, because the JDK hangs. (Maybe there is a bug in my test, feel
free to enlighten me.)
I don't think we should do anything special here. I agree it is less
than perfect, but it isn't clear what the right thing is, and
compatibility with the JDK seems hard.
If the situation changes wrt the JDK, feel free to reopen the PR. We
can always address it later.
Tom
public class q implements Runnable
{
public static Thread t_bad, t_good;
public boolean bad_flag;
public void run () throws InterruptedException
{
if (bad_flag)
{
throw new NullPointerException ("zardoz!");
}
else
{
t_bad.join ();
}
}
public q (boolean x)
{
bad_flag = x;
}
public static void main (String[] args) throws InterruptedException
{
q t1 = new q (true);
q t2 = new q (false);
t_bad = Thread.currentThread ();
t_good = new Thread (t2);
t_good.start ();
t1.run ();
}
}
More information about the Java-prs
mailing list