Takes one count from the semaphore, waiting for signal if there is none. The result says whether it got one: .SUCCESS,
.TIMEOUT or .ERROR.
- milliseconds: how long to wait at most. 0 only tries; -1 waits as long as it takes.
wait_for :: (s: *Semaphore, milliseconds: s32 = -1) -> Wait_For_Result
Takes one count from the semaphore, waiting for signal if there is none. The result says whether it got one: .SUCCESS,
.TIMEOUT or .ERROR.
Parameters
- s: *Semaphore
- milliseconds: s32 = -1
- how long to wait at most. 0 only tries; -1 waits as long as it takes.
Returns
wait_for :: (s: *Semaphore, milliseconds: s32 = -1) -> Wait_For_Result
Takes one count from the semaphore, waiting for signal if there is none. The result says whether it got one: .SUCCESS,
.TIMEOUT or .ERROR.
Parameters
- s: *Semaphore
- milliseconds: s32 = -1
- how long to wait at most. 0 only tries; -1 waits as long as it takes.
Returns
semaphore: Semaphore;
init(*semaphore);
defer destroy(*semaphore);
assert(wait_for(*semaphore, 10) == .TIMEOUT);