+2005-06-29 Tom Tromey <tromey@redhat.com>
+
+ PR libgcj/22211:
+ * testsuite/libjava.lang/pr22211.java: New file.
+ * java/lang/natThread.cc (finish_): Synchronize when updating
+ alive_flag.
+ (_Jv_AttachCurrentThread): Likewise.
+ (interrupt): Only call _Jv_ThreadInterrupt if thread is alive.
+ * java/lang/Thread.java (isAlive): Now synchronized.
+
2005-06-29 Tom Tromey <tromey@redhat.com>
* interpret.cc (run) <insn_checkcast, checkcast_resolved>: Use
// 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.
{
checkAccess ();
natThread *nt = (natThread *) data;
- _Jv_ThreadInterrupt (nt->thread);
+ JvSynchronize sync (this);
+ if (alive_flag)
+ _Jv_ThreadInterrupt (nt->thread);
}
void
// 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);
}
jint
_Jv_AttachCurrentThread(java::lang::Thread* thread)
{
+ JvSynchronize sync (thread);
if (thread == NULL || thread->startable_flag == false)
return -1;
thread->startable_flag = false;