changeset 289:3529d0e8d09c

6608862: segv in JvmtiEnvBase::check_for_periodic_clean_up() Reviewed-by: dholmes, dcubed, jcoomes
author xlu
date Fri, 15 Aug 2008 10:08:20 -0700
parents 51ae48d8072f
children 6e76352f1f62
files src/share/vm/runtime/thread.cpp
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/runtime/thread.cpp	Wed Aug 13 08:56:44 2008 -0400
+++ b/src/share/vm/runtime/thread.cpp	Fri Aug 15 10:08:20 2008 -0700
@@ -2756,7 +2756,13 @@
   // For now, just manually iterate through them.
   tc->do_thread(VMThread::vm_thread());
   Universe::heap()->gc_threads_do(tc);
-  tc->do_thread(WatcherThread::watcher_thread());
+  {
+    // Grab the Terminator_lock to prevent watcher_thread from being terminated.
+    MutexLockerEx mu(Terminator_lock, Mutex::_no_safepoint_check_flag);
+    WatcherThread *wt = WatcherThread::watcher_thread();
+    if (wt != NULL)
+      tc->do_thread(wt);
+  }
   // If CompilerThreads ever become non-JavaThreads, add them here
 }