diff options
author | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-22 06:47:48 +0000 |
---|---|---|
committer | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-22 06:47:48 +0000 |
commit | 98cf095aceed6a89d0524b8cfbcb11a5ee823c70 (patch) | |
tree | ecfc0fb5d915f5f6596ef061114d1b6b7ec5270a /libjava/win32-threads.cc | |
parent | 4737d8efd8bdfccb3d0d41413aaf3933f25780ce (diff) | |
download | gcc-98cf095aceed6a89d0524b8cfbcb11a5ee823c70.tar.gz |
Implement invocation interface; don't create new thread for main.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42428 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/win32-threads.cc')
-rw-r--r-- | libjava/win32-threads.cc | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/libjava/win32-threads.cc b/libjava/win32-threads.cc index 29b6a72a8fc..974f15622a5 100644 --- a/libjava/win32-threads.cc +++ b/libjava/win32-threads.cc @@ -35,7 +35,6 @@ extern "C" struct starter { _Jv_ThreadStartFunc *method; - java::lang::Thread *object; _Jv_Thread_t *data; }; @@ -124,10 +123,11 @@ _Jv_InitThreads (void) } _Jv_Thread_t * -_Jv_ThreadInitData (java::lang::Thread *) +_Jv_ThreadInitData (java::lang::Thread* obj) { _Jv_Thread_t *data = new _Jv_Thread_t; data->flags = 0; + data->thread_obj = obj; return data; } @@ -176,6 +176,20 @@ _Jv_ThreadSetPriority (_Jv_Thread_t *data, jint prio) } } +void +_Jv_ThreadRegister (_Jv_Thread_t *data) +{ + TlsSetValue (_Jv_ThreadKey, data->thread_obj); + TlsSetValue (_Jv_ThreadDataKey, data); +} + +void +_Jv_ThreadUnRegister () +{ + TlsSetValue (_Jv_ThreadKey, NULL); + TlsSetValue (_Jv_ThreadDataKey, NULL); +} + // This function is called when a thread is started. We don't arrange // to call the `run' method directly, because this function must // return a value. @@ -184,9 +198,9 @@ really_start (void* x) { struct starter *info = (struct starter *) x; - TlsSetValue (_Jv_ThreadKey, info->object); - TlsSetValue (_Jv_ThreadDataKey, info->data); - info->method (info->object); + _Jv_ThreadRegister (info->data); + + info->method (info->data->thread_obj); if (! (info->data->flags & FLAG_DAEMON)) { @@ -214,7 +228,6 @@ _Jv_ThreadStart (java::lang::Thread *thread, _Jv_Thread_t *data, _Jv_ThreadStart // FIXME: handle marking the info object for GC. info = (struct starter *) _Jv_AllocBytes (sizeof (struct starter)); info->method = meth; - info->object = thread; info->data = data; if (! thread->isDaemon ()) |