[][src]Trait rtfm::Mutex

pub trait Mutex {
    type T;
    fn lock<R>(&mut self, f: impl FnOnce(&mut Self::T) -> R) -> R;
}

Memory safe access to shared resources

In RTFM, locks are implemented as critical sections that prevent other tasks from starting. These critical sections are implemented by temporarily increasing the dynamic priority (see BASEPRI) of the current context. Entering and leaving these critical sections is always done in constant time (a few instructions).

Associated Types

type T

Data protected by the mutex

Loading content...

Required methods

fn lock<R>(&mut self, f: impl FnOnce(&mut Self::T) -> R) -> R

Creates a critical section and grants temporary access to the protected data

Loading content...

Implementors

impl<'a, M> Mutex for &'a mut M where
    M: Mutex
[src]

type T = M::T

impl<'a, T> Mutex for Exclusive<'a, T>[src]

type T = T

Loading content...