Skip to main content

LocalLock

Struct LocalLock 

Source
pub struct LocalLock<T> { /* private fields */ }
Expand description

One RT lock and protected value per possible CPU.

Acquisition first pins migration, then selects that CPU’s lock. Tasks on the same CPU may preempt one another and synchronize through PI contention.

Implementations§

Source§

impl<T> LocalLock<T>

Source

pub fn new(init: impl FnMut(CpuId) -> T) -> Result<Self, TaskError>

Initializes one protected value for every configured CPU.

Source

pub fn lock(&self) -> LocalLockGuard<'_, T>

Acquires the calling task’s CPU-local value in preemptible task context.

Source

pub fn try_lock(&self) -> Option<LocalLockGuard<'_, T>>

Attempts acquisition without sleeping.

Source

pub fn lock_irqsave(&self) -> LocalLockGuard<'_, T>

RT IRQ-save spelling; hardware IRQ state is unchanged.

Source

pub fn try_lock_irqsave(&self) -> Option<LocalLockGuard<'_, T>>

RT IRQ-save spelling; hardware IRQ state is unchanged.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for LocalLock<T>

§

impl<T> Freeze for LocalLock<T>
where Vec<SpinLock<T>>: Freeze,

§

impl<T> Send for LocalLock<T>
where Vec<SpinLock<T>>: Send,

§

impl<T> Sync for LocalLock<T>
where Vec<SpinLock<T>>: Sync,

§

impl<T> Unpin for LocalLock<T>
where Vec<SpinLock<T>>: Unpin,

§

impl<T> UnsafeUnpin for LocalLock<T>

§

impl<T> UnwindSafe for LocalLock<T>
where Vec<SpinLock<T>>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.