diff options
Diffstat (limited to 'libjava/java/lang/natThread.cc')
-rw-r--r-- | libjava/java/lang/natThread.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libjava/java/lang/natThread.cc b/libjava/java/lang/natThread.cc index e79ab11..f1064f1 100644 --- a/libjava/java/lang/natThread.cc +++ b/libjava/java/lang/natThread.cc @@ -1,6 +1,6 @@ // natThread.cc - Native part of Thread class. -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation This file is part of libgcj. @@ -115,7 +115,9 @@ java::lang::Thread::interrupt (void) { checkAccess (); natThread *nt = (natThread *) data; - _Jv_ThreadInterrupt (nt->thread); + JvSynchronize sync (this); + if (alive_flag) + _Jv_ThreadInterrupt (nt->thread); } void @@ -215,7 +217,12 @@ java::lang::Thread::finish_ () // Signal any threads that are waiting to join() us. _Jv_MutexLock (&nt->join_mutex); - alive_flag = false; + + { + JvSynchronize sync (this); + alive_flag = false; + } + _Jv_CondNotifyAll (&nt->join_cond, &nt->join_mutex); _Jv_MutexUnlock (&nt->join_mutex); } @@ -392,6 +399,7 @@ _Jv_SetCurrentJNIEnv (JNIEnv *env) jint _Jv_AttachCurrentThread(java::lang::Thread* thread) { + JvSynchronize sync (thread); if (thread == NULL || thread->startable_flag == false) return -1; thread->startable_flag = false; |