mainthread = thread_new(THREAD_FLAG_JAVA);
+ /* Add the thread to the thread list. */
+
+ ThreadList::add_to_active_thread_list(mainthread);
+
/* The main thread should always have index 1. */
if (mainthread->index != 1)
t = ThreadList::get_free_thread();
+ /* Unlock the thread lists. */
+
+ ThreadList::unlock();
+
if (t != NULL) {
/* Equivalent of MZERO on the else path */
threads_impl_thread_reuse(t);
- /* Add the thread to the thread list. */
-
- ThreadList::add_to_active_thread_list(t);
-
- /* Unlock the thread lists. */
-
- ThreadList::unlock();
-
return t;
}
t = thread_new(THREAD_FLAG_INTERNAL | THREAD_FLAG_DAEMON);
+ /* Add the thread to the thread list. */
+
+ ThreadList::add_to_active_thread_list(t);
+
/* The thread is flagged as (non-)daemon thread, we can leave the
mutex. */
t->flags |= THREAD_FLAG_DAEMON;
#endif
- /* The thread is flagged and (non-)daemon thread, we can leave the
- mutex. */
-
- threads_mutex_join_unlock();
-
/* Link the two objects together. */
thread_set_object(t, object);
+ /* Add the thread to the thread list. */
+
+ ThreadList::add_to_active_thread_list(t);
+
+ threads_mutex_join_unlock();
+
ThreadRuntime::setup_thread_vmdata(jlt, t);
/* Start the thread. Don't pass a function pointer (NULL) since
/* The thread is flagged and (non-)daemon thread, we can leave the
mutex. */
+ /* Add the thread to the thread list. */
+
+ ThreadList::add_to_active_thread_list(t);
+
threads_mutex_join_unlock();
DEBUGTHREADS("attaching", t);