hotspot/src/os/windows/vm/threadCritical_windows.cpp
ThreadCritical::~ThreadCritical() {
{- -------------------------------------------
(1) (assert)
---------------------------------------- -}
assert(lock_owner == GetCurrentThreadId(), "unlock attempt by wrong thread");
assert(lock_count >= 0, "Attempt to unlock when already unlocked");
{- -------------------------------------------
(1) ロックの再帰確保数が 0 であれば,
lock_owner 及び lock_count を元に戻す.
またロック待ちでブロックしているスレッドがいるかもしれないので, SetEvent() も呼んでおく.
---------------------------------------- -}
if (lock_count == 0) {
// We're going to unlock
lock_owner = -1;
lock_count = -1;
// No lost wakeups, lock_event stays signaled until reset.
DWORD ret = SetEvent(lock_event);
assert(ret != 0, "unexpected return value from SetEvent");
{- -------------------------------------------
(1) ロックの再帰確保数が 0 でなければ, デクリメントするだけ.
---------------------------------------- -}
} else {
// Just unwinding a recursive lock;
lock_count--;
}
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.