< prev index next >

src/share/vm/runtime/vmThread.cpp

Print this page
rev 12310 : [mq]: gcinterface.patch


 261   // Wait for VM_Operations until termination
 262   this->loop();
 263 
 264   // Note the intention to exit before safepointing.
 265   // 6295565  This has the effect of waiting for any large tty
 266   // outputs to finish.
 267   if (xtty != NULL) {
 268     ttyLocker ttyl;
 269     xtty->begin_elem("destroy_vm");
 270     xtty->stamp();
 271     xtty->end_elem();
 272     assert(should_terminate(), "termination flag must be set");
 273   }
 274 
 275   // 4526887 let VM thread exit at Safepoint
 276   SafepointSynchronize::begin();
 277 
 278   if (VerifyBeforeExit) {
 279     HandleMark hm(VMThread::vm_thread());
 280     // Among other things, this ensures that Eden top is correct.
 281     Universe::heap()->prepare_for_verify();
 282     // Silent verification so as not to pollute normal output,
 283     // unless we really asked for it.
 284     Universe::verify();
 285   }
 286 
 287   CompileBroker::set_should_block();
 288 
 289   // wait for threads (compiler threads or daemon threads) in the
 290   // _thread_in_native state to block.
 291   VM_Exit::wait_for_threads_in_native_to_block();
 292 
 293   // signal other threads that VM process is gone
 294   {
 295     // Note: we must have the _no_safepoint_check_flag. Mutex::lock() allows
 296     // VM thread to enter any lock at Safepoint as long as its _owner is NULL.
 297     // If that happens after _terminate_lock->wait() has unset _owner
 298     // but before it actually drops the lock and waits, the notification below
 299     // may get lost and we will have a hang. To avoid this, we need to use
 300     // Mutex::lock_without_safepoint_check().
 301     MutexLockerEx ml(_terminate_lock, Mutex::_no_safepoint_check_flag);




 261   // Wait for VM_Operations until termination
 262   this->loop();
 263 
 264   // Note the intention to exit before safepointing.
 265   // 6295565  This has the effect of waiting for any large tty
 266   // outputs to finish.
 267   if (xtty != NULL) {
 268     ttyLocker ttyl;
 269     xtty->begin_elem("destroy_vm");
 270     xtty->stamp();
 271     xtty->end_elem();
 272     assert(should_terminate(), "termination flag must be set");
 273   }
 274 
 275   // 4526887 let VM thread exit at Safepoint
 276   SafepointSynchronize::begin();
 277 
 278   if (VerifyBeforeExit) {
 279     HandleMark hm(VMThread::vm_thread());
 280     // Among other things, this ensures that Eden top is correct.
 281     GC::gc()->heap()->prepare_for_verify();
 282     // Silent verification so as not to pollute normal output,
 283     // unless we really asked for it.
 284     Universe::verify();
 285   }
 286 
 287   CompileBroker::set_should_block();
 288 
 289   // wait for threads (compiler threads or daemon threads) in the
 290   // _thread_in_native state to block.
 291   VM_Exit::wait_for_threads_in_native_to_block();
 292 
 293   // signal other threads that VM process is gone
 294   {
 295     // Note: we must have the _no_safepoint_check_flag. Mutex::lock() allows
 296     // VM thread to enter any lock at Safepoint as long as its _owner is NULL.
 297     // If that happens after _terminate_lock->wait() has unset _owner
 298     // but before it actually drops the lock and waits, the notification below
 299     // may get lost and we will have a hang. To avoid this, we need to use
 300     // Mutex::lock_without_safepoint_check().
 301     MutexLockerEx ml(_terminate_lock, Mutex::_no_safepoint_check_flag);


< prev index next >