2775 } |
2775 } |
2776 // Someday we could have a table or list of all non-JavaThreads. |
2776 // Someday we could have a table or list of all non-JavaThreads. |
2777 // For now, just manually iterate through them. |
2777 // For now, just manually iterate through them. |
2778 tc->do_thread(VMThread::vm_thread()); |
2778 tc->do_thread(VMThread::vm_thread()); |
2779 Universe::heap()->gc_threads_do(tc); |
2779 Universe::heap()->gc_threads_do(tc); |
2780 { |
2780 WatcherThread *wt = WatcherThread::watcher_thread(); |
2781 // Grab the Terminator_lock to prevent watcher_thread from being terminated. |
2781 // Strictly speaking, the following NULL check isn't sufficient to make sure |
2782 MutexLockerEx mu(Terminator_lock, Mutex::_no_safepoint_check_flag); |
2782 // the data for WatcherThread is still valid upon being examined. However, |
2783 WatcherThread *wt = WatcherThread::watcher_thread(); |
2783 // considering that WatchThread terminates when the VM is on the way to |
2784 if (wt != NULL) |
2784 // exit at safepoint, the chance of the above is extremely small. The right |
2785 tc->do_thread(wt); |
2785 // way to prevent termination of WatcherThread would be to acquire |
2786 } |
2786 // Terminator_lock, but we can't do that without violating the lock rank |
|
2787 // checking in some cases. |
|
2788 if (wt != NULL) |
|
2789 tc->do_thread(wt); |
|
2790 |
2787 // If CompilerThreads ever become non-JavaThreads, add them here |
2791 // If CompilerThreads ever become non-JavaThreads, add them here |
2788 } |
2792 } |
2789 |
2793 |
2790 jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { |
2794 jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { |
2791 |
2795 |