osfmk/man/semaphore_wait.html
Function - Wait on the specified semaphore.
**kern\_return\_t semaphore\_wait**** (semaphore\_t **semaphore** );**
semaphore[in send right] The port naming the semaphore that the wait operation is being performed upon.
The semaphore_wait function decrements the semaphore count. If the semaphore count is negative after decrementing, the calling thread blocks. Device driver interrupt service routines (ISR) should never execute semaphore_wait , since waiting on a semaphore at the ISR level may, and often will, lead to a deadlock.
KERN_INVALID_ARGUMENT The specified semaphore is invalid.
KERN_TERMINATED The specified semaphore has been destroyed.
KERN_ABORTED The caller was blocked due to a negative count on the semaphore, and was awoken for a reason not related to the semaphore subsystem (e.g. thread_terminate ).
KERN_SUCCESS The semaphore wait operation was successful.
Functions: semaphore_create, semaphore_destroy, semaphore_signal, semaphore_signal_all, device_get_status.