pub struct Mutex<T> { /* private fields */ }Expand description
A mutex with waitqueue.
Implementations§
Source§impl<T> Mutex<T>
impl<T> Mutex<T>
Sourcepub exec fn lock(&self) -> MutexGuard<'_, T>
pub exec fn lock(&self) -> MutexGuard<'_, T>
Acquires the mutex.
This method runs in a block way until the mutex can be acquired.
Sourcepub exec fn try_lock(&self) -> Option<MutexGuard<'_, T>>
pub exec fn try_lock(&self) -> Option<MutexGuard<'_, T>>
Tries to acquire the mutex immediately.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Mutex<T>
impl<T> !RefUnwindSafe for Mutex<T>
impl<T> Unpin for Mutex<T>where
T: Unpin,
impl<T> UnwindSafe for Mutex<T>where
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more