Semaphore.wait

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.

  1. void wait()
  2. bool wait(Duration period)
    class Semaphore
    bool
    wait

Parameters

period Duration

The time to wait.

In: period must be non-negative.

Return Value

Type: bool

true if notified before the timeout and false if not.

Throws

SyncError on error.

Meta