< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page
rev 49501 : 8200374: Add ThreadsSMRSupport::verify_hazard_pointer_scanned() to verify threads_do().
rev 49502 : Add missing NULL check; use proper lock-free get/set with TracingExport::_sampler_thread.
rev 49503 : Rename TracingExport::get_sampler_thread() to TracingExport::sampler_thread_acquire() and TracingExport::set_sampler_thread() to TracingExport::set_sampler_thread_with_lock(); set_sampler_thread_with_lock() uses Threads_lock toavoid conflicts with Thread-SMR scans.


3437 void Threads::non_java_threads_do(ThreadClosure* tc) {
3438   // Someday we could have a table or list of all non-JavaThreads.
3439   // For now, just manually iterate through them.
3440   tc->do_thread(VMThread::vm_thread());
3441   if (Universe::heap() != NULL) {
3442     Universe::heap()->gc_threads_do(tc);
3443   }
3444   WatcherThread *wt = WatcherThread::watcher_thread();
3445   // Strictly speaking, the following NULL check isn't sufficient to make sure
3446   // the data for WatcherThread is still valid upon being examined. However,
3447   // considering that WatchThread terminates when the VM is on the way to
3448   // exit at safepoint, the chance of the above is extremely small. The right
3449   // way to prevent termination of WatcherThread would be to acquire
3450   // Terminator_lock, but we can't do that without violating the lock rank
3451   // checking in some cases.
3452   if (wt != NULL) {
3453     tc->do_thread(wt);
3454   }
3455 
3456 #if INCLUDE_TRACE
3457   Thread* sampler_thread = TracingExport::get_sampler_thread();
3458   if (sampler_thread != NULL) {
3459     tc->do_thread(sampler_thread);
3460   }
3461 #endif
3462 
3463   // If CompilerThreads ever become non-JavaThreads, add them here
3464 }
3465 
3466 // All JavaThreads + all non-JavaThreads (i.e., every thread in the system).
3467 void Threads::threads_do(ThreadClosure* tc) {
3468   assert_locked_or_safepoint(Threads_lock);
3469   // ALL_JAVA_THREADS iterates through all JavaThreads.
3470   ALL_JAVA_THREADS(p) {
3471     tc->do_thread(p);
3472   }
3473   non_java_threads_do(tc);
3474 }
3475 
3476 void Threads::possibly_parallel_threads_do(bool is_par, ThreadClosure* tc) {
3477   int cp = Threads::thread_claim_parity();




3437 void Threads::non_java_threads_do(ThreadClosure* tc) {
3438   // Someday we could have a table or list of all non-JavaThreads.
3439   // For now, just manually iterate through them.
3440   tc->do_thread(VMThread::vm_thread());
3441   if (Universe::heap() != NULL) {
3442     Universe::heap()->gc_threads_do(tc);
3443   }
3444   WatcherThread *wt = WatcherThread::watcher_thread();
3445   // Strictly speaking, the following NULL check isn't sufficient to make sure
3446   // the data for WatcherThread is still valid upon being examined. However,
3447   // considering that WatchThread terminates when the VM is on the way to
3448   // exit at safepoint, the chance of the above is extremely small. The right
3449   // way to prevent termination of WatcherThread would be to acquire
3450   // Terminator_lock, but we can't do that without violating the lock rank
3451   // checking in some cases.
3452   if (wt != NULL) {
3453     tc->do_thread(wt);
3454   }
3455 
3456 #if INCLUDE_TRACE
3457   Thread* sampler_thread = TracingExport::sampler_thread_acquire();
3458   if (sampler_thread != NULL) {
3459     tc->do_thread(sampler_thread);
3460   }
3461 #endif
3462 
3463   // If CompilerThreads ever become non-JavaThreads, add them here
3464 }
3465 
3466 // All JavaThreads + all non-JavaThreads (i.e., every thread in the system).
3467 void Threads::threads_do(ThreadClosure* tc) {
3468   assert_locked_or_safepoint(Threads_lock);
3469   // ALL_JAVA_THREADS iterates through all JavaThreads.
3470   ALL_JAVA_THREADS(p) {
3471     tc->do_thread(p);
3472   }
3473   non_java_threads_do(tc);
3474 }
3475 
3476 void Threads::possibly_parallel_threads_do(bool is_par, ThreadClosure* tc) {
3477   int cp = Threads::thread_claim_parity();


< prev index next >