hotspot/src/share/vm/runtime/vm_operations.cpp
int VM_Exit::set_vm_exited() {
{- -------------------------------------------
(1) (変数宣言など)
---------------------------------------- -}
Thread * thr_cur = ThreadLocalStorage::get_thread_slow();
{- -------------------------------------------
(1) (assert)
---------------------------------------- -}
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint already");
{- -------------------------------------------
(1) (変数宣言など)
---------------------------------------- -}
int num_active = 0;
{- -------------------------------------------
(1) まだネイティブコードを実行中のスレッドのために以下の処理を行う.
(これは終了したことを通達するための処理)
* VM_Exit::_vm_exited フラグを true にする.
(See: VM_Exit::wait_if_vm_exited(), VM_Exit::block_if_vm_exited(), VMError::report())
* ネイティブコードを実行中の全ての JavaThread について,
JavaThread::_terminated フィールドの値を
JavaThread::_vm_exited 定数に書き換えておく.
(See: JavaThread::block_if_vm_exited())
---------------------------------------- -}
_shutdown_thread = thr_cur;
_vm_exited = true; // global flag
for(JavaThread *thr = Threads::first(); thr != NULL; thr = thr->next())
if (thr!=thr_cur && thr->thread_state() == _thread_in_native) {
++num_active;
thr->set_terminated(JavaThread::_vm_exited); // per-thread flag
}
{- -------------------------------------------
(1) リターン
---------------------------------------- -}
return num_active;
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.