Struct ruspiro_lock::sync::Spinlock[][src]

#[repr(C, align(16))]
pub struct Spinlock { /* fields omitted */ }
Expand description

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.

Implementations

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();

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

Release an aquired spinlock.

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

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.