src/share/vm/runtime/thread.cpp
Print this page
rev 6498 : 8044796: G1: Enable G1CollectedHeap::stop()
Reviewed-by:
*** 3966,3983 ****
{
// 4945125 The vm thread comes to a safepoint during exit.
// GC vm_operations can get caught at the safepoint, and the
// heap is unparseable if they are caught. Grab the Heap_lock
// to prevent this. The GC vm_operations will not be able to
! // queue until after the vm thread is dead.
! // After this point, we'll never emerge out of the safepoint before
! // the VM exits, so concurrent GC threads do not need to be explicitly
! // stopped; they remain inactive until the process exits.
! // Note: some concurrent G1 threads may be running during a safepoint,
! // but these will not be accessing the heap, just some G1-specific side
! // data structures that are not accessed by any other threads but them
! // after this point in a terminal safepoint.
MutexLocker ml(Heap_lock);
VMThread::wait_for_vm_thread_exit();
assert(SafepointSynchronize::is_at_safepoint(), "VM thread should exit at Safepoint");
--- 3966,3977 ----
{
// 4945125 The vm thread comes to a safepoint during exit.
// GC vm_operations can get caught at the safepoint, and the
// heap is unparseable if they are caught. Grab the Heap_lock
// to prevent this. The GC vm_operations will not be able to
! // 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);
VMThread::wait_for_vm_thread_exit();
assert(SafepointSynchronize::is_at_safepoint(), "VM thread should exit at Safepoint");