From b77bcf3b81f9f42dfcaeec549a2a066e4b996110 Mon Sep 17 00:00:00 2001 From: Stefan Ring Date: Fri, 13 May 2011 18:01:24 +0200 Subject: [PATCH] * src/threads/thread.cpp: Set thread to RUNNABLE during Thread.start. * 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 | 4 ---- src/threads/thread.cpp | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/threads/posix/thread-posix.cpp b/src/threads/posix/thread-posix.cpp index ce03f8016..859354d2e 100644 --- a/src/threads/posix/thread-posix.cpp +++ b/src/threads/posix/thread-posix.cpp @@ -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! */ diff --git a/src/threads/thread.cpp b/src/threads/thread.cpp index b111ca90f..dad552bd1 100644 --- a/src/threads/thread.cpp +++ b/src/threads/thread.cpp @@ -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. */ -- 2.25.1