]>
Commit | Line | Data |
---|---|---|
9bccf70c | 1 | <h2>semaphore_wait</h2>\r<hr>\r<p>\r<strong>Function</strong> - Wait on the specified semaphore.\r<h3>SYNOPSIS</h3>\r<pre>\r<strong>kern_return_t semaphore_wait</strong>\r <strong>(semaphore_t</strong> <var>semaphore</var><strong>);</strong>\r</pre>\r<h3>PARAMETERS</h3>\r<dl>\r<p>\r<dt> <var>semaphore</var>\r<dd>\r[in send right] The port naming the semaphore that the wait operation is being performed upon.\r</dl>\r<h3>DESCRIPTION</h3>\r<p>\rThe <strong>semaphore_wait</strong> function decrements the semaphore count. If the\rsemaphore count is negative after decrementing, the calling thread\rblocks. Device driver interrupt service routines (ISR) should never\rexecute <strong>semaphore_wait</strong>, since waiting on a semaphore at the ISR level\rmay, and often will, lead to a deadlock.\r<h3>RETURN VALUES</h3>\r<dl>\r<p>\r<dt> <strong>KERN_INVALID_ARGUMENT</strong>\r<dd>\rThe specified semaphore is invalid.\r<p>\r<dt> <strong>KERN_TERMINATED</strong>\r<dd>\rThe specified semaphore has been destroyed.\r<p>\r<dt> <strong>KERN_ABORTED</strong>\r<dd>\rThe caller was blocked due to a negative count on the semaphore, and was\r awoken for a reason not related to the semaphore subsystem\r (e.g. <strong>thread_terminate</strong>).\r<p>\r<dt> <strong>KERN_SUCCESS</strong>\r<dd>\rThe semaphore wait operation was successful.\r</dl>\r<h3>RELATED INFORMATION</h3>\r<p>\rFunctions:\r<a href="semaphore_create.html"><strong>semaphore_create</strong></a>,\r<a href="semaphore_destroy.html"><strong>semaphore_destroy</strong></a>,\r<a href="semaphore_signal.html"><strong>semaphore_signal</strong></a>,\r<a href="semaphore_signal_all.html"><strong>semaphore_signal_all</strong></a>,\r<a href="device_get_status.html"><strong>device_get_status</strong></a>.\r |