* src/threads/thread.cpp: Set thread to RUNNABLE during Thread.start.
authorStefan Ring <stefan@complang.tuwien.ac.at>
Fri, 13 May 2011 16:01:24 +0000 (18:01 +0200)
committerStefan Ring <stefan@complang.tuwien.ac.at>
Fri, 13 May 2011 16:01:24 +0000 (18:01 +0200)
* src/threads/posix/thread-posix.cpp: Removed state-setting function call that
would be done by the thread itself, creating a nasty race.

src/threads/posix/thread-posix.cpp
src/threads/thread.cpp

index ce03f801636ba8632a11cc2831ea393155d40c4e..859354d2ef680c7bd30a26644c3a52ab768231ea 100644 (file)
@@ -722,10 +722,6 @@ static void *threads_startup_thread(void *arg)
 
        threads_set_thread_priority(t->tid, jlt.get_priority());
 
-       /* Thread is completely initialized. */
-
-       thread_set_state_runnable(t);
-
        /* tell threads_startup_thread that we registered ourselves */
        /* CAUTION: *startup becomes invalid with this!             */
 
index b111ca90f70bdaf74e9f073f93bf49e970ed65e0..dad552bd16b7c307f4993e709b4f6e403dfc44be 100644 (file)
@@ -469,6 +469,8 @@ void threads_thread_start(java_handle_t *object)
 
        Finalizer::attach_custom_finalizer(LLNI_WRAP(t->object), thread_cleanup_finalizer, t);
 
+       thread_set_state_runnable(t);
+
        /* Start the thread.  Don't pass a function pointer (NULL) since
           we want Thread.run()V here. */