Lines Matching full:mutex
3 //! A kernel mutex.
5 //! This module allows Rust code to use the kernel's `struct mutex`.
7 /// Creates a [`Mutex`] initialiser with the given name and a newly-created lock class.
14 $crate::sync::Mutex::new(
22 /// Exposes the kernel's [`struct mutex`]. When multiple threads attempt to lock the same mutex,
23 /// only one at a time is allowed to progress, the others will block (sleep) until the mutex is
26 /// Since it may block, [`Mutex`] needs to be used with care in atomic contexts.
28 /// Instances of [`Mutex`] need a lock class and to be pinned. The recommended way to create such
34 /// contains an inner struct (`Inner`) that is protected by a mutex.
37 /// use kernel::sync::{new_mutex, Mutex};
48 /// d: Mutex<Inner>,
69 /// protected by a mutex despite only having a shared reference:
72 /// use kernel::sync::Mutex;
79 /// fn example(m: &Mutex<Example>) {
86 /// [`struct mutex`]: srctree/include/linux/mutex.h
87 pub type Mutex<T> = super::Lock<T, MutexBackend>; typedef
89 /// A [`Guard`] acquired from locking a [`Mutex`].
91 /// This is simply a type alias for a [`Guard`] returned from locking a [`Mutex`]. It will unlock
92 /// the [`Mutex`] upon being dropped.
97 /// A kernel `struct mutex` lock backend.
100 // SAFETY: The underlying kernel `struct mutex` object ensures mutual exclusion.
102 type State = bindings::mutex;
123 // caller is the owner of the mutex. in unlock()