Function

dispatch_semaphore_wait

Waits for (decrements) a semaphore.

Declaration

long 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.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software