* src/threads/threadlist.hpp (add_to_active_thread_list): Take the thread list
lock when changing the thread list.
mainthread = thread_new(THREAD_FLAG_JAVA);
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)
/* The main thread should always have index 1. */
if (mainthread->index != 1)
t = ThreadList::get_free_thread();
t = ThreadList::get_free_thread();
+ /* Unlock the thread lists. */
+
+ ThreadList::unlock();
+
if (t != NULL) {
/* Equivalent of MZERO on the else path */
if (t != NULL) {
/* Equivalent of MZERO on the else path */
threads_impl_thread_reuse(t);
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();
-
t = thread_new(THREAD_FLAG_INTERNAL | THREAD_FLAG_DAEMON);
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. */
/* The thread is flagged as (non-)daemon thread, we can leave the
mutex. */
t->flags |= THREAD_FLAG_DAEMON;
#endif
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);
/* 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
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. */
/* 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);
threads_mutex_join_unlock();
DEBUGTHREADS("attaching", t);
/* src/threads/threadlist.hpp - different thread-lists
/* src/threads/threadlist.hpp - different thread-lists
- Copyright (C) 2008, 2009
+ Copyright (C) 1996-2011
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
static void lock() { _mutex.lock(); }
static void unlock() { _mutex.unlock(); }
static void lock() { _mutex.lock(); }
static void unlock() { _mutex.unlock(); }
static void add_to_active_thread_list(threadobject* t);
// Thread management methods.
static void add_to_active_thread_list(threadobject* t);
// Thread management methods.
inline void ThreadList::add_to_active_thread_list(threadobject* t)
{
inline void ThreadList::add_to_active_thread_list(threadobject* t)
{
_active_thread_list.push_back(t);
// Update counter variables.
_active_thread_list.push_back(t);
// Update counter variables.
_number_of_active_java_threads++;
_peak_of_active_java_threads = MAX(_peak_of_active_java_threads, _number_of_active_java_threads);
}
_number_of_active_java_threads++;
_peak_of_active_java_threads = MAX(_peak_of_active_java_threads, _number_of_active_java_threads);
}
}
inline void ThreadList::remove_from_active_thread_list(threadobject* t)
}
inline void ThreadList::remove_from_active_thread_list(threadobject* t)