* src/threads/native/threads.c (threads_detach_thread): Notify all
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Sun, 16 Sep 2007 14:24:10 +0000 (16:24 +0200)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Sun, 16 Sep 2007 14:24:10 +0000 (16:24 +0200)
threads waiting on the Java thread-object.

src/threads/native/threads.c

index 66d82b679727d89764b8ed272d760f7f302d2281..9478d2df80329cceba1ba9f3b133cb6ffd0a519e 100644 (file)
@@ -1606,7 +1606,7 @@ bool threads_detach_thread(threadobject *t)
        }
 #endif
 
-       /* thread is terminated */
+       /* Thread has terminated. */
 
        threads_thread_state_terminated(t);
 
@@ -1618,6 +1618,19 @@ bool threads_detach_thread(threadobject *t)
        }
 #endif
 
+    /* Notify all threads waiting on this thread.  These are joining
+          this thread. */
+
+       o = (java_object_t *) object;
+
+       /* XXX Care about exceptions? */
+       (void) lock_monitor_enter(o);
+       
+       lock_notify_all_object(o);
+
+       /* XXX Care about exceptions? */
+       (void) lock_monitor_exit(o);
+
        /* Enter the join-mutex before calling threads_thread_free, so
           threads_join_all_threads gets the correct number of non-daemon
           threads. */