pub struct MutexImpl<T: ?Sized, M> { /* private fields */ }Expand description
Mutual exclusion access to a contained value. Can be recursive - the current owner of a lock can re-lock it.
Implementations§
Source§impl<T, M> MutexImpl<T, M>where
M: MutexInnerImpl,
impl<T, M> MutexImpl<T, M>where
M: MutexInnerImpl,
Sourcepub fn new(value: T) -> Result<Self, FreeRtosError>
pub fn new(value: T) -> Result<Self, FreeRtosError>
Create a new mutex with the given inner value
Sourcepub fn lock<D: DurationTicks>(
&self,
max_wait: D,
) -> Result<MutexGuard<'_, T, M>, FreeRtosError>
pub fn lock<D: DurationTicks>( &self, max_wait: D, ) -> Result<MutexGuard<'_, T, M>, FreeRtosError>
Try to obtain a lock and mutable access to our inner value
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consume the mutex and return its inner value
Sourcepub fn get_mut(&mut self) -> &mut T
pub fn get_mut(&mut self) -> &mut T
Get mutable reference to inner value.
This method does not lock the mutex because mutable reference guarantees exclusive access.
Sourcepub fn from_parts(mutex: M, value: T) -> Self
pub fn from_parts(mutex: M, value: T) -> Self
Create owning mutex from non-owning mutex and inner value.
It is safe to pass an already locked mutex although it is not recommended.
Sourcepub fn into_parts(self) -> (M, T)
pub fn into_parts(self) -> (M, T)
Split owning mutex into non-owning mutex and inner value.
Sourcepub fn inner_mutex_mut(&mut self) -> &mut M
pub fn inner_mutex_mut(&mut self) -> &mut M
Get mutable reference to inner non-owning mutex.