This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Thread.setDaemon() patch


Hi,

Here is a small patch that fixes a corner case in setDaemon(). You may
not call setDaemon() after the Thread is started even when it is already
finished and not alive anymore.

2002-10-06  Mark Wielaard  <mark@klomp.org>

    * java/lang/Thread.java (setDaemon): Check startable_flag,
    not isAlive().

OK to commit?

Cheers,

Mark

--- java/lang/Thread.java	29 Aug 2002 17:53:28 -0000	1.23
+++ java/lang/Thread.java	5 Oct 2002 21:50:51 -0000
@@ -137,7 +137,7 @@
   public final void setDaemon (boolean status)
   {
     checkAccess ();
-    if (isAlive ())
+    if (!startable_flag)
       throw new IllegalThreadStateException ();
     daemon_flag = status;
   }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]