[][src]Struct r3::sync::mutex::Mutex

pub struct Mutex<System, T> { /* fields omitted */ }

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 calling Mutex::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

impl<System, T> Unpin for Mutex<System, T> where
    System: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.