[][src]Struct ruspiro_lock::spinlock::Spinlock

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

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 Unpin for Spinlock

impl Send for Spinlock

impl Sync for Spinlock

Blanket Implementations

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

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

type Error = !

The type returned in the event of a conversion error.

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

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.

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

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

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