[][src]Struct sunrise_kernel::sync::spin_lock_irq::SpinLockIRQ

pub struct SpinLockIRQ<T: ?Sized> {
    internal: SpinLock<T>,
}

SpinLock that disables IRQ.

Description

This type behaves like a spinlock from the Linux crate. For simplicity of use and implementation. The mapping is as follows:

This means that locking a spinlock disables interrupts until all spinlock guards have been dropped.

A note on reordering: reordering lock drops is prohibited and doing so will result in UB.

Fields

internal: SpinLock<T>

SpinLock we wrap.

Implementations

impl<T> SpinLockIRQ<T>[src]

pub const fn new(internal: T) -> SpinLockIRQ<T>[src]

Creates a new spinlockirq wrapping the supplied data.

pub fn into_inner(self) -> T[src]

Consumes this SpinLockIRQ, returning the underlying data.

impl<T: ?Sized> SpinLockIRQ<T>[src]

pub fn lock(&self) -> SpinLockIRQGuard<T>[src]

Disables interrupts and locks the mutex.

pub fn try_lock(&self) -> Option<SpinLockIRQGuard<T>>[src]

Disables interrupts and locks the mutex.

pub unsafe fn force_unlock(&self)[src]

Force unlocks the lock.

Safety

This is completely unsafe. It does not reset the interrupt status register, potentially causing deadlock. It should only be used when all hope is already lost.

Trait Implementations

impl<T: Debug> Debug for SpinLockIRQ<T>[src]

impl<'a, T> Lock<'a, SpinLockIRQGuard<'a, T>> for SpinLockIRQ<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for SpinLockIRQ<T>

impl<T: ?Sized> Send for SpinLockIRQ<T> where
    T: Send

impl<T: ?Sized> Sync for SpinLockIRQ<T> where
    T: Send

impl<T: ?Sized> Unpin for SpinLockIRQ<T> where
    T: Unpin

impl<T: ?Sized> UnwindSafe for SpinLockIRQ<T> where
    T: UnwindSafe

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.