1 <h2>semaphore_wait
</h2>
4 <strong>Function
</strong> - Wait on the specified semaphore.
7 <strong>kern_return_t semaphore_wait
</strong>
8 <strong>(semaphore_t
</strong> <var>semaphore
</var><strong>);
</strong>
13 <dt> <var>semaphore
</var>
15 [in send right] The port naming the semaphore that the wait operation is being performed upon.
19 The
<strong>semaphore_wait
</strong> function decrements the semaphore count. If the
20 semaphore count is negative after decrementing, the calling thread
21 blocks. Device driver interrupt service routines (ISR) should never
22 execute
<strong>semaphore_wait
</strong>, since waiting on a semaphore at the ISR level
23 may, and often will, lead to a deadlock.
24 <h3>RETURN VALUES
</h3>
27 <dt> <strong>KERN_INVALID_ARGUMENT
</strong>
29 The specified semaphore is invalid.
31 <dt> <strong>KERN_TERMINATED
</strong>
33 The specified semaphore has been destroyed.
35 <dt> <strong>KERN_ABORTED
</strong>
37 The caller was blocked due to a negative count on the semaphore, and was
38 awoken for a reason not related to the semaphore subsystem
39 (e.g.
<strong>thread_terminate
</strong>).
41 <dt> <strong>KERN_SUCCESS
</strong>
43 The semaphore wait operation was successful.
45 <h3>RELATED INFORMATION
</h3>
48 <a href=
"semaphore_create.html"><strong>semaphore_create
</strong></a>,
49 <a href=
"semaphore_destroy.html"><strong>semaphore_destroy
</strong></a>,
50 <a href=
"semaphore_signal.html"><strong>semaphore_signal
</strong></a>,
51 <a href=
"semaphore_signal_all.html"><strong>semaphore_signal_all
</strong></a>,
52 <a href=
"device_get_status.html"><strong>device_get_status
</strong></a>.