[][src]Struct ruspiro_lock::Spinlock

#[repr(C)]
pub struct Spinlock { /* fields omitted */ }

A blocking cross core lock to guarantee mutual exclusive access. While this lock might block other cores to continue processing this lock should be held as short as possible. Also care shall be taken while using this lock within interrupt handlers, as this might lead to deadlock situations if the lock holding core is interrupted and the interrupt is also trying to aquire the same lock.

Methods

impl Spinlock[src]

pub const fn new() -> Spinlock[src]

Create a new Spinlock. To ensure it is shared between cores, it's typically assigned to a static variable

Example

static LOCK: Spinlock = Spinlock::new();

pub fn aquire(&self)[src]

Aquire a spinlock. This will block the current core until the lock could be aquired.

Example

static LOCK: Spinlock = Spinlock::new();
    LOCK.aquire();
    // execution continues only if the lock could be aquired

pub fn release(&self)[src]

Release an aquired spinlock.

Example

static LOCK: Spinlock = Spinlock::new();
    LOCK.release();

Trait Implementations

impl Debug for Spinlock[src]

Auto Trait Implementations

impl Send for Spinlock

impl Sync for Spinlock

impl Unpin for Spinlock

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.