windows/ConditionVariable
Raw operating-system-thread wait primitive over one supplied mutex. wait temporarily releases that mutex, waits, and reacquires the same mode before return.
ConditionVariable
Methods
INIT |
(--) |
Resets the condition variable to the initial empty-waiter state. |
wait |
(mutex time shared -- signaled) |
Waits on the supplied mutex. The lock is released while waiting and reacquired in the same mode before return. The result is TRUE when waiting ends before timeout and FALSE when a finite timeout expires. |
Preconditions
- The current thread already holds
mutex in exclusive mode when shared is FALSE.
- The current thread already holds
mutex in shared mode when shared is TRUE.
wakeAll |
(--) |
Releases every thread that is already waiting at that moment. |
wakeOne |
(--) |
Releases one thread that is already waiting at that moment. |
Remarks
Wait semantics
wait borrows the supplied mutex.
- With
shared equal to FALSE, wait temporarily releases one exclusive acquisition and reacquires exclusive mode before return.
- With
shared equal to TRUE, wait temporarily releases one shared acquisition and reacquires shared mode before return.
time is measured in milliseconds.
time equal to -1 selects an infinite wait.
wait returns TRUE when waiting ends before timeout and FALSE only when a finite timeout expires.
wakeOne affects at most one thread that is already waiting, and wakeAll affects every thread that is already waiting.
- No wake is remembered for later waiters.
wakeAll and wakeOne return no status value.
See also
- windows/Mutex: SRW lock wrapper with exclusive and shared locking.
- lockGuard: Scope-based locking and unlocking helpers.
- sync/Event: Persistent event state with clear, set, wait, wake, and wakeOne.
- sync/Signal: Wait queue with wake and wakeOne operations.
- sync/sync: Cross-platform scheduling, sleep, time, IPv4 formatting, and TCP helpers.