changeset 52408:e256b3b62e20

8213236: A partial removed/deleted JavaThread cannot transition Reviewed-by: dholmes, dcubed, eosterlund
author rehn
date Fri, 02 Nov 2018 14:13:05 +0100
parents 5c679ec60888
children 8c0b1894d524
files src/hotspot/share/runtime/thread.cpp src/hotspot/share/runtime/vmThread.cpp
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/runtime/thread.cpp	Fri Nov 02 08:33:59 2018 +0100
+++ b/src/hotspot/share/runtime/thread.cpp	Fri Nov 02 14:13:05 2018 +0100
@@ -4286,7 +4286,7 @@
     // queue until after the vm thread is dead. After this point,
     // we'll never emerge out of the safepoint before the VM exits.
 
-    MutexLocker ml(Heap_lock);
+    MutexLockerEx ml(Heap_lock, Mutex::_no_safepoint_check_flag);
 
     VMThread::wait_for_vm_thread_exit();
     assert(SafepointSynchronize::is_at_safepoint(), "VM thread should exit at Safepoint");
--- a/src/hotspot/share/runtime/vmThread.cpp	Fri Nov 02 08:33:59 2018 +0100
+++ b/src/hotspot/share/runtime/vmThread.cpp	Fri Nov 02 14:13:05 2018 +0100
@@ -319,7 +319,9 @@
 // Notify the VMThread that the last non-daemon JavaThread has terminated,
 // and wait until operation is performed.
 void VMThread::wait_for_vm_thread_exit() {
-  { MutexLocker mu(VMOperationQueue_lock);
+  assert(Thread::current()->is_Java_thread(), "Should be a JavaThread");
+  assert(((JavaThread*)Thread::current())->is_terminated(), "Should be terminated");
+  { MutexLockerEx mu(VMOperationQueue_lock, Mutex::_no_safepoint_check_flag);
     _should_terminate = true;
     VMOperationQueue_lock->notify();
   }