pub struct Mutex<T> { /* private fields */ }
Expand description
A mutex that protects an object from being accessed in both an IRQ and normal code at once.
Note that this does not support blocking like a typical mutex, and instead mainly exists for memory safety reasons.
Implementations§
source§impl<T> Mutex<T>
impl<T> Mutex<T>
sourcepub fn lock(&self) -> MutexGuard<'_, T>
pub fn lock(&self) -> MutexGuard<'_, T>
Returns a guard for this lock, or panics if there is another lock active.
sourcepub fn try_lock(&self) -> Option<MutexGuard<'_, T>>
pub fn try_lock(&self) -> Option<MutexGuard<'_, T>>
Returns a guard for this lock or None
if there is another lock active.