Skip to content
Updated Pseudo Code (markdown) authored by LIU Hao's avatar LIU Hao
...@@ -312,12 +312,12 @@ Wakes up another thread that is sleeping because of `RELEASE_KEYED_EVENT(key, ti ...@@ -312,12 +312,12 @@ Wakes up another thread that is sleeping because of `RELEASE_KEYED_EVENT(key, ti
pOnceFlag->bLocked = true; pOnceFlag->bLocked = true;
return _MCFCRT_kOnceResultInitial; return _MCFCRT_kOnceResultInitial;
} }
// Once flags don't support spinning to simplify their design.
// Tell another thread which is going to unlock this once flag that there // Tell another thread which is going to unlock this once flag that there
// is a new waiter by incrementing the number of threads trapped. // is a new waiter by incrementing the number of threads trapped.
// Note all this requires that there MUST be such a thread (in other // Note all this requires that there MUST be such a thread (in other
// words, the once flag must have been locked), otherwise we get a deadlock // words, the once flag must have been locked), otherwise we get a deadlock
// in this thread. // in this thread.
// Note once flags don't support spinning to simplify their design.
pOnceFlag->uThreadsTrapped += 1; pOnceFlag->uThreadsTrapped += 1;
} }
NTSTATUS lStatus = WAIT_FOR_KEYED_EVENT(pOnceFlag, u64UntilFastMonoClock); NTSTATUS lStatus = WAIT_FOR_KEYED_EVENT(pOnceFlag, u64UntilFastMonoClock);
... ...
......