projects
/
cacao.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* src/threads/thread.cpp: thread_new no longer adds to active list.
[cacao.git]
/
src
/
threads
/
thread.cpp
diff --git
a/src/threads/thread.cpp
b/src/threads/thread.cpp
index c8c3abcd808529d7ee6714051bd2b2a2177b6717..15bd67c5898826a6025cd91ea238c058cec4be1e 100644
(file)
--- a/
src/threads/thread.cpp
+++ b/
src/threads/thread.cpp
@@
-139,6
+139,10
@@
void threads_preinit(void)
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)
@@
-280,6
+284,10
@@
static threadobject *thread_new(int32_t flags)
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 */
@@
-343,14
+351,6
@@
static threadobject *thread_new(int32_t flags)
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();
-
return t;
}
return t;
}
@@
-403,6
+403,10
@@
bool threads_thread_start_internal(utf *name, functionptr f)
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. */
@@
-454,15
+458,16
@@
void threads_thread_start(java_handle_t *object)
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
@@
-517,6
+522,10
@@
bool thread_attach_current_thread(JavaVMAttachArgs *vm_aargs, bool isdaemon)
/* 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);