Semaphore.wait

void wait()

Wait until the current count is above zero, then atomically decrement the count by one and return.

Throws

SyncError on error.
bool wait( Duration period )

Suspends the calling thread until the current count moves above zero or until the supplied time period has elapsed. If the count moves above zero in this interval, then atomically decrement the count by one and return true. Otherwise, return false.

Parameters

periodThe time to wait. In: period must be non-negative.

Throws

SyncError on error.

Returns

true if notified before the timeout and false if not.