< prev index next >
src/hotspot/share/runtime/threadSMR.cpp
Print this page
rev 56552 : imported patch 8218543-2
*** 526,535 ****
--- 526,551 ----
if (ThreadsSMRSupport::is_bootstrap_list(_list)) {
// We are early in VM bootstrapping so nothing to do here.
return;
}
+ if ( _thread == VM_Exit::shutdown_thread()) {
+ // The shutdown thread has removed itself from the Threads
+ // list and is safe to have a waiver from this check because
+ // VM_Exit::_shutdown_thread is not set until after the VMThread
+ // has started the final safepoint which holds the Threads_lock
+ // for the remainder of the VM's life.
+ return;
+ }
+
+ if (VMError::is_error_reported() &&
+ VMError::get_first_error_tid() == os::current_thread_id()) {
+ // If there is an error reported by this thread it may use ThreadsList even
+ // if it's unsafe.
+ return;
+ }
+
// The closure will attempt to verify that the calling thread can
// be found by threads_do() on the specified ThreadsList. If it
// is successful, then the specified ThreadsList was acquired as
// a stable hazard ptr by the calling thread in a way that honored
// the Thread-SMR protocol.
*** 538,563 ****
// it is not the shutdown thread, then the calling thread is not
// honoring the Thread-SMR ptotocol. This means that the specified
// ThreadsList is not a stable hazard ptr and can be freed by
// another thread from the to-be-deleted list at any time.
//
- // Note: The shutdown thread has removed itself from the Threads
- // list and is safe to have a waiver from this check because
- // VM_Exit::_shutdown_thread is not set until after the VMThread
- // has started the final safepoint which holds the Threads_lock
- // for the remainder of the VM's life.
- //
VerifyHazardPtrThreadClosure cl(_thread);
ThreadsSMRSupport::threads_do(&cl, _list);
// If the calling thread is not honoring the Thread-SMR protocol,
// then we will either crash in threads_do() above because 'threads'
// was freed by another thread or we will fail the assert() below.
// In either case, we won't get past this point with a badly placed
// ThreadsListHandle.
! assert(cl.found() || _thread == VM_Exit::shutdown_thread(), "Acquired a ThreadsList snapshot from a thread not recognized by the Thread-SMR protocol.");
#endif
}
// 'entries + 1' so we always have at least one entry.
ThreadsList::ThreadsList(int entries) :
--- 554,573 ----
// it is not the shutdown thread, then the calling thread is not
// honoring the Thread-SMR ptotocol. This means that the specified
// ThreadsList is not a stable hazard ptr and can be freed by
// another thread from the to-be-deleted list at any time.
//
VerifyHazardPtrThreadClosure cl(_thread);
ThreadsSMRSupport::threads_do(&cl, _list);
// If the calling thread is not honoring the Thread-SMR protocol,
// then we will either crash in threads_do() above because 'threads'
// was freed by another thread or we will fail the assert() below.
// In either case, we won't get past this point with a badly placed
// ThreadsListHandle.
! assert(cl.found(), "Acquired a ThreadsList snapshot from a thread not recognized by the Thread-SMR protocol.");
#endif
}
// 'entries + 1' so we always have at least one entry.
ThreadsList::ThreadsList(int entries) :
< prev index next >