mutex_trylock(9)

mutex_trylock9

Try to acquire the mutex, without waiting

Usage

int __sched mutex_trylock(struct mutex * lock);

Arguments

lock

the mutex to be acquired

Overview

Try to acquire the mutex atomically. Returns 1 if the mutex has been acquired successfully, and 0 on contention.

Note

this function follows the spin_trylock convention, so it is negated from the down_trylock return values! Be careful about this when converting semaphore users to mutexes.

This function must not be used in interrupt context. The mutex must be released by the same task that acquired it.

Releases

3 releases since Debian 7 (Wheezy); the text changed 2 times.

  1. 7
  2. 8
  3. 9

Author

Rusty Russell <[email protected]>

Author.

From linux-manual-4.9 4.9.228-1 in Debian 9 (Stretch). Parsed by carta from the page's man source.