< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page




4456   // the final safepoint which will block all the Compiler threads.
4457   // Note that this Thread has already logically exited so the
4458   // clean_up() function's use of a JavaThreadIteratorWithHandle
4459   // would be a problem except set_vm_exited() has remembered the
4460   // shutdown thread which is granted a policy exception.
4461 #if defined(COMPILER2) && !defined(PRODUCT)
4462   IdealGraphPrinter::clean_up();
4463 #endif
4464 
4465   notify_vm_shutdown();
4466 
4467   // exit_globals() will delete tty
4468   exit_globals();
4469 
4470   // We are here after VM_Exit::set_vm_exited() so we can't call
4471   // thread->smr_delete() or we will block on the Threads_lock.
4472   // We must check there are no active references to this thread
4473   // before attempting to delete it. A thread could be waiting
4474   // on _handshake_turn_sem trying to execute a direct handshake
4475   // with this thread.
4476   if (!ThreadsSMRSupport::is_a_protected_JavaThread_with_lock((JavaThread *) thread, true /* skiplock */)) {
4477     delete thread;
4478   } else {
4479     // Clear value for _thread_key in TLS to prevent, depending
4480     // on pthreads implementation, possible execution of
4481     // thread-specific destructor in infinite loop at thread
4482     // exit.
4483     Thread::clear_thread_current();
4484   }
4485 
4486 #if INCLUDE_JVMCI
4487   if (JVMCICounterSize > 0) {
4488     FREE_C_HEAP_ARRAY(jlong, JavaThread::_jvmci_old_thread_counters);
4489   }
4490 #endif
4491 
4492   LogConfiguration::finalize();
4493 
4494   return true;
4495 }
4496 




4456   // the final safepoint which will block all the Compiler threads.
4457   // Note that this Thread has already logically exited so the
4458   // clean_up() function's use of a JavaThreadIteratorWithHandle
4459   // would be a problem except set_vm_exited() has remembered the
4460   // shutdown thread which is granted a policy exception.
4461 #if defined(COMPILER2) && !defined(PRODUCT)
4462   IdealGraphPrinter::clean_up();
4463 #endif
4464 
4465   notify_vm_shutdown();
4466 
4467   // exit_globals() will delete tty
4468   exit_globals();
4469 
4470   // We are here after VM_Exit::set_vm_exited() so we can't call
4471   // thread->smr_delete() or we will block on the Threads_lock.
4472   // We must check there are no active references to this thread
4473   // before attempting to delete it. A thread could be waiting
4474   // on _handshake_turn_sem trying to execute a direct handshake
4475   // with this thread.
4476   if (!ThreadsSMRSupport::is_a_protected_JavaThread((JavaThread *) thread)) {
4477     delete thread;
4478   } else {
4479     // Clear value for _thread_key in TLS to prevent, depending
4480     // on pthreads implementation, possible execution of
4481     // thread-specific destructor in infinite loop at thread
4482     // exit.
4483     Thread::clear_thread_current();
4484   }
4485 
4486 #if INCLUDE_JVMCI
4487   if (JVMCICounterSize > 0) {
4488     FREE_C_HEAP_ARRAY(jlong, JavaThread::_jvmci_old_thread_counters);
4489   }
4490 #endif
4491 
4492   LogConfiguration::finalize();
4493 
4494   return true;
4495 }
4496 


< prev index next >