Lines Matching full:mutex
3 //! A kernel mutex.
5 //! This module allows Rust code to use the kernel's `struct mutex`.
9 /// Creates a [`Mutex`] initialiser with the given name and a newly-created lock class.
16 $crate::sync::Mutex::new(
23 /// Exposes the kernel's [`struct mutex`]. When multiple threads attempt to lock the same mutex,
24 /// only one at a time is allowed to progress, the others will block (sleep) until the mutex is
27 /// Since it may block, [`Mutex`] needs to be used with care in atomic contexts.
29 /// Instances of [`Mutex`] need a lock class and to be pinned. The recommended way to create such
35 /// contains an inner struct (`Inner`) that is protected by a mutex.
38 /// use kernel::{init::InPlaceInit, init::PinInit, new_mutex, pin_init, sync::Mutex};
49 /// d: Mutex<Inner>,
70 /// protected by a mutex despite only having a shared reference:
73 /// use kernel::sync::Mutex;
80 /// fn example(m: &Mutex<Example>) {
87 /// [`struct mutex`]: ../../../../include/linux/mutex.h
88 pub type Mutex<T> = super::Lock<T, MutexBackend>; typedef
90 /// A kernel `struct mutex` lock backend.
93 // SAFETY: The underlying kernel `struct mutex` object ensures mutual exclusion.
95 type State = bindings::mutex;
116 // caller is the owner of the mutex. in unlock()