1*fdd8201dSApple OSS Distributions<h2>semaphore_wait</h2> 2*fdd8201dSApple OSS Distributions<hr> 3*fdd8201dSApple OSS Distributions<p> 4*fdd8201dSApple OSS Distributions<strong>Function</strong> - Wait on the specified semaphore. 5*fdd8201dSApple OSS Distributions<h3>SYNOPSIS</h3> 6*fdd8201dSApple OSS Distributions<pre> 7*fdd8201dSApple OSS Distributions<strong>kern_return_t semaphore_wait</strong> 8*fdd8201dSApple OSS Distributions <strong>(semaphore_t</strong> <var>semaphore</var><strong>);</strong> 9*fdd8201dSApple OSS Distributions</pre> 10*fdd8201dSApple OSS Distributions<h3>PARAMETERS</h3> 11*fdd8201dSApple OSS Distributions<dl> 12*fdd8201dSApple OSS Distributions<p> 13*fdd8201dSApple OSS Distributions<dt> <var>semaphore</var> 14*fdd8201dSApple OSS Distributions<dd> 15*fdd8201dSApple OSS Distributions[in send right] The port naming the semaphore that the wait operation is being performed upon. 16*fdd8201dSApple OSS Distributions</dl> 17*fdd8201dSApple OSS Distributions<h3>DESCRIPTION</h3> 18*fdd8201dSApple OSS Distributions<p> 19*fdd8201dSApple OSS DistributionsThe <strong>semaphore_wait</strong> function decrements the semaphore count. If the 20*fdd8201dSApple OSS Distributionssemaphore count is negative after decrementing, the calling thread 21*fdd8201dSApple OSS Distributionsblocks. Device driver interrupt service routines (ISR) should never 22*fdd8201dSApple OSS Distributionsexecute <strong>semaphore_wait</strong>, since waiting on a semaphore at the ISR level 23*fdd8201dSApple OSS Distributionsmay, and often will, lead to a deadlock. 24*fdd8201dSApple OSS Distributions<h3>RETURN VALUES</h3> 25*fdd8201dSApple OSS Distributions<dl> 26*fdd8201dSApple OSS Distributions<p> 27*fdd8201dSApple OSS Distributions<dt> <strong>KERN_INVALID_ARGUMENT</strong> 28*fdd8201dSApple OSS Distributions<dd> 29*fdd8201dSApple OSS DistributionsThe specified semaphore is invalid. 30*fdd8201dSApple OSS Distributions<p> 31*fdd8201dSApple OSS Distributions<dt> <strong>KERN_TERMINATED</strong> 32*fdd8201dSApple OSS Distributions<dd> 33*fdd8201dSApple OSS DistributionsThe specified semaphore has been destroyed. 34*fdd8201dSApple OSS Distributions<p> 35*fdd8201dSApple OSS Distributions<dt> <strong>KERN_ABORTED</strong> 36*fdd8201dSApple OSS Distributions<dd> 37*fdd8201dSApple OSS DistributionsThe caller was blocked due to a negative count on the semaphore, and was 38*fdd8201dSApple OSS Distributions awoken for a reason not related to the semaphore subsystem 39*fdd8201dSApple OSS Distributions (e.g. <strong>thread_terminate</strong>). 40*fdd8201dSApple OSS Distributions<p> 41*fdd8201dSApple OSS Distributions<dt> <strong>KERN_SUCCESS</strong> 42*fdd8201dSApple OSS Distributions<dd> 43*fdd8201dSApple OSS DistributionsThe semaphore wait operation was successful. 44*fdd8201dSApple OSS Distributions</dl> 45*fdd8201dSApple OSS Distributions<h3>RELATED INFORMATION</h3> 46*fdd8201dSApple OSS Distributions<p> 47*fdd8201dSApple OSS DistributionsFunctions: 48*fdd8201dSApple OSS Distributions<a href="semaphore_create.html"><strong>semaphore_create</strong></a>, 49*fdd8201dSApple OSS Distributions<a href="semaphore_destroy.html"><strong>semaphore_destroy</strong></a>, 50*fdd8201dSApple OSS Distributions<a href="semaphore_signal.html"><strong>semaphore_signal</strong></a>, 51*fdd8201dSApple OSS Distributions<a href="semaphore_signal_all.html"><strong>semaphore_signal_all</strong></a>, 52*fdd8201dSApple OSS Distributions<a href="device_get_status.html"><strong>device_get_status</strong></a>. 53