hotspot/src/share/vm/utilities/workgroup.cpp
void SubTasksDone::all_tasks_completed() {
{- -------------------------------------------
(1) _threads_completed を Atomic::cmpxchg() でアトミックにインクリメントする.
(Atomic::cmpxchg() が成功するまでループ)
---------------------------------------- -}
jint observed = _threads_completed;
jint old;
do {
old = observed;
observed = Atomic::cmpxchg(old+1, &_threads_completed, old);
} while (observed != old);
{- -------------------------------------------
(1) もし全スレッドが処理を終えていれば(threads_completed == _n_threads),
次回の処理に備えて, SubTasksDone::clear() で SubTasksDone オブジェクトの状態を初期状態に戻しておく.
---------------------------------------- -}
// If this was the last thread checking in, clear the tasks.
if (observed+1 == _n_threads) clear();
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.