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