dispatch_semaphore_wait
Waits for (decrements) a semaphore.
Declaration
extern intptr_t dispatch_semaphore_wait(dispatch_semaphore_t dsema, dispatch_time_t timeout);Parameters
- dsema:
The semaphore. This parameter cannot be
NULL. - timeout:
When to timeout (see Dispatch_time). The constants Dispatch_time_now and Dispatch_time_forever are available as a convenience.
Return Value
Returns zero on success, or non-zero if the timeout occurred.
Discussion
Decrement the counting semaphore. If the resulting value is less than zero, this function waits for a signal to occur before returning.