1MUTEX_TRYLOCK(9) Mutex API reference MUTEX_TRYLOCK(9)
2
3
4
6 mutex_trylock - try to acquire the mutex, without waiting
7
9 int __sched mutex_trylock(struct mutex * lock);
10
12 lock
13 the mutex to be acquired
14
16 Try to acquire the mutex atomically. Returns 1 if the mutex has been
17 acquired successfully, and 0 on contention.
18
20 this function follows the spin_trylock convention, so it is negated
21 from the down_trylock return values! Be careful about this when
22 converting semaphore users to mutexes.
23
24 This function must not be used in interrupt context. The mutex must be
25 released by the same task that acquired it.
26
28 Rusty Russell <rusty@rustcorp.com.au>
29 Author.
30
32Kernel Hackers Manual 3.10 June 2019 MUTEX_TRYLOCK(9)