1*fdd8201dSApple OSS Distributions<h2>evc_wait</h2> 2*fdd8201dSApple OSS Distributions<hr> 3*fdd8201dSApple OSS Distributions<p> 4*fdd8201dSApple OSS Distributions<strong>System Trap</strong> - Wait for a kernel (device) signalled event. 5*fdd8201dSApple OSS Distributions<h3>SYNOPSIS</h3> 6*fdd8201dSApple OSS Distributions<pre> 7*fdd8201dSApple OSS Distributions<strong>kern_return_t evc_wait</strong> 8*fdd8201dSApple OSS Distributions <strong>(unsigned int</strong> <var>event</var><strong>);</strong> 9*fdd8201dSApple OSS Distributions</pre> 10*fdd8201dSApple OSS Distributions<h3>PARAMETERS</h3> 11*fdd8201dSApple OSS Distributions<dl> 12*fdd8201dSApple OSS Distributions<dt> <var>event</var> 13*fdd8201dSApple OSS Distributions<dd> 14*fdd8201dSApple OSS Distributions[in scalar] The task local event ID of the kernel event object. 15*fdd8201dSApple OSS Distributions</dl> 16*fdd8201dSApple OSS Distributions<h3>DESCRIPTION</h3> 17*fdd8201dSApple OSS Distributions<p> 18*fdd8201dSApple OSS DistributionsThe <strong>evc_wait</strong> function causes the invoking thread to wait until the 19*fdd8201dSApple OSS Distributionsspecified kernel (device) generated <var>event</var> occurs. Device drivers 20*fdd8201dSApple OSS Distributions(typically mapped devices intended to be supported by user space 21*fdd8201dSApple OSS Distributionsdrivers) may supply an <var>event</var> service. The <var>event</var> service defines one 22*fdd8201dSApple OSS Distributionsor more <var>event</var> objects, named by task local <var>event</var> IDs. Each of these 23*fdd8201dSApple OSS Distributions<var>event</var> objects has an associated <var>event</var> count, initially zero. Whenever 24*fdd8201dSApple OSS Distributionsthe associated <var>event</var> occurs (typically a device interrupt), the <var>event</var> 25*fdd8201dSApple OSS Distributionscount is incremented. If this count is zero when <strong>evc_wait</strong> is called, 26*fdd8201dSApple OSS Distributionsthe calling thread waits for the next <var>event</var> to occur. Only one thread 27*fdd8201dSApple OSS Distributionsmay be waiting for the <var>event</var> to occur. If the count is non-zero when 28*fdd8201dSApple OSS Distributions<strong>evc_wait</strong> is called, the count is simply decremented without causing 29*fdd8201dSApple OSS Distributionsthe thread to wait. The <var>event</var> count guarantees that no <var>event</var>s are 30*fdd8201dSApple OSS Distributionslost. 31*fdd8201dSApple OSS Distributions<h3>NOTES</h3> 32*fdd8201dSApple OSS Distributions<p> 33*fdd8201dSApple OSS DistributionsThe typical use of this service is within user space device 34*fdd8201dSApple OSS Distributionsdrivers. When a device interrupt occurs, the (in this case, simple) 35*fdd8201dSApple OSS Distributionskernel device driver would place device status in a shared (with the 36*fdd8201dSApple OSS Distributionsuser device driver) memory window (established by <strong>device_map</strong>) and 37*fdd8201dSApple OSS Distributionssignal the associated <var>event</var>. The user space device driver would 38*fdd8201dSApple OSS Distributionsnormally be waiting with <strong>evc_wait</strong>. The user thread then wakes, 39*fdd8201dSApple OSS Distributionsprocesses the device status, typically interacting with the device via 40*fdd8201dSApple OSS Distributionsits shared memory window, then waits for the next interrupt. 41*fdd8201dSApple OSS Distributions<h3>RETURN VALUES</h3> 42*fdd8201dSApple OSS Distributions<dl> 43*fdd8201dSApple OSS Distributions<dt> <strong>KERN_NO_SPACE</strong> 44*fdd8201dSApple OSS Distributions<dd> 45*fdd8201dSApple OSS DistributionsThere is already a thread waiting for this event. 46*fdd8201dSApple OSS Distributions</dl> 47*fdd8201dSApple OSS Distributions<h3>RELATED INFORMATION</h3> 48*fdd8201dSApple OSS Distributions<p> 49*fdd8201dSApple OSS DistributionsFunctions: 50*fdd8201dSApple OSS Distributions<a href="device_map.html"><strong>device_map</strong></a>. 51