1*42e22086SApple OSS Distributions<h2>lock_try</h2> 2*42e22086SApple OSS Distributions<hr> 3*42e22086SApple OSS Distributions<p> 4*42e22086SApple OSS Distributions<strong>Function</strong> - Attempt to acquire access rights to a lock. 5*42e22086SApple OSS Distributions<h3>SYNOPSIS</h3> 6*42e22086SApple OSS Distributions<pre> 7*42e22086SApple OSS Distributions<strong>kern_return_t lock_try</strong> 8*42e22086SApple OSS Distributions <strong>(lock_set_t</strong> <var>lock_set</var>, 9*42e22086SApple OSS Distributions <strong>int</strong> <var>lock_id</var><strong>);</strong> 10*42e22086SApple OSS Distributions</pre> 11*42e22086SApple OSS Distributions<h3>PARAMETERS</h3> 12*42e22086SApple OSS Distributions<dl> 13*42e22086SApple OSS Distributions<p> 14*42e22086SApple OSS Distributions<dt> <var>lock_set</var> 15*42e22086SApple OSS Distributions<dd> 16*42e22086SApple OSS Distributions[in send right] The port naming the lock set which represents the lock. 17*42e22086SApple OSS Distributions<p> 18*42e22086SApple OSS Distributions<dt> <var>lock_id</var> 19*42e22086SApple OSS Distributions<dd> 20*42e22086SApple OSS Distributions[in scalar] The lock, represented by the lock set, to be acquired. 21*42e22086SApple OSS Distributions</dl> 22*42e22086SApple OSS Distributions<h3>DESCRIPTION</h3> 23*42e22086SApple OSS Distributions<p> 24*42e22086SApple OSS DistributionsThe <strong>lock_try</strong> function attempts to acquire the specified lock without 25*42e22086SApple OSS Distributionsblocking. The return value indicates whether the lock was acquired. 26*42e22086SApple OSS Distributions<h3>RETURN VALUES</h3> 27*42e22086SApple OSS Distributions<dl> 28*42e22086SApple OSS Distributions<p> 29*42e22086SApple OSS Distributions<dt> <strong>KERN_INVALID_ARGUMENT</strong> 30*42e22086SApple OSS Distributions<dd> 31*42e22086SApple OSS DistributionsThe specified lock_set is invalid, or the lock_id is out of range. 32*42e22086SApple OSS Distributions<p> 33*42e22086SApple OSS Distributions<dt> <strong>KERN_SUCCESS</strong> 34*42e22086SApple OSS Distributions<dd> 35*42e22086SApple OSS DistributionsThe lock was acquired. 36*42e22086SApple OSS Distributions<p> 37*42e22086SApple OSS Distributions<dt> <strong>KERN_LOCK_UNSTABLE</strong> 38*42e22086SApple OSS Distributions<dd> 39*42e22086SApple OSS DistributionsThe acquired lock has an unstable state. 40*42e22086SApple OSS Distributions<p> 41*42e22086SApple OSS Distributions<dt> <strong>KERN_LOCK_SET_DESTROYED</strong> 42*42e22086SApple OSS Distributions<dd> 43*42e22086SApple OSS DistributionsThe specified lock has been destroyed. 44*42e22086SApple OSS Distributions<p> 45*42e22086SApple OSS Distributions<dt> <strong>KERN_LOCK_OWNED</strong> 46*42e22086SApple OSS Distributions<dd> 47*42e22086SApple OSS DistributionsAnother thread currently owns the requested lock. 48*42e22086SApple OSS Distributions<p> 49*42e22086SApple OSS Distributions<dt> <strong>KERN_LOCK_OWNED_SELF</strong> 50*42e22086SApple OSS Distributions<dd> 51*42e22086SApple OSS DistributionsThe calling thread already owns the lock. 52*42e22086SApple OSS Distributions</dl> 53*42e22086SApple OSS Distributions<h3>RELATED INFORMATION</h3> 54*42e22086SApple OSS Distributions<p> 55*42e22086SApple OSS DistributionsFunctions: 56*42e22086SApple OSS Distributions<a href="lock_acquire.html"><strong>lock_acquire</strong></a>, 57*42e22086SApple OSS Distributions<a href="lock_make_stable.html"><strong>lock_make_stable</strong></a>, 58*42e22086SApple OSS Distributions<a href="lock_release.html"><strong>lock_release</strong></a>, 59*42e22086SApple OSS Distributions<a href="lock_handoff.html"><strong>lock_handoff</strong></a>, 60*42e22086SApple OSS Distributions<a href="lock_handoff_accept.html"><strong>lock_handoff_accept</strong></a>, 61*42e22086SApple OSS Distributions<a href="lock_set_create.html"><strong>lock_set_create</strong></a>, 62*42e22086SApple OSS Distributions<a href="lock_set_destroy.html"><strong>lock_set_destroy</strong></a>. 63