[−][src]Struct r3::sync::mutex::Mutex
A mutual exclusion primitive useful for protecting shared data from concurrent access.
This type is implemented using r3::kernel::Mutex
, the low-level
synchronization primitive and therefore inherits its properties.
The important inherited properties are listed below:
-
When trying to lock an abandoned mutex, the lock function will return
Err(LockError::Abandoned(lock_guard))
. This state can be exited by callingMutex::mark_consistent
. -
Mutexes must be unlocked in a lock-reverse order.
MutexGuard
::drop
will panic if this is violated.
Implementations
impl<System: Kernel, T: 'static> Mutex<System, T>
[src]
pub const fn build() -> Builder<System, T, DefaultInitTag>
[src]
Construct a Builder
to define a mutex in a configuration
function.
impl<System: Kernel, T: 'static> Mutex<System, T>
[src]
pub fn lock(&self) -> LockResult<MutexGuard<'_, System, T>>
[src]
Acquire the mutex, blocking the current thread until it is able to do so.
pub fn try_lock(&self) -> TryLockResult<MutexGuard<'_, System, T>>
[src]
Attempt to acquire the mutex.
pub fn mark_consistent(&self) -> Result<(), MarkConsistentError>
[src]
Mark the state protected by the mutex as consistent.
pub fn get_ptr(&self) -> *mut T
[src]
Get a raw pointer to the contained data.
Trait Implementations
impl<System: Kernel, T: Debug + 'static> Debug for Mutex<System, T>
[src]
impl<System: Kernel, T: 'static + Send> Send for Mutex<System, T>
[src]
impl<System: Kernel, T: 'static + Send> Sync for Mutex<System, T>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,