[−][src]Struct sunrise_kernel::sync::spin_lock_irq::SpinLockIRQ
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:
lock
behaves like aspinlock_irqsave
. It returns a guard.- Dropping the guard behaves like
spinlock_irqrestore
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]
fn lock(&self) -> SpinLockIRQGuard<T>
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for SpinLockIRQ<T>
impl<T: ?Sized> Send for SpinLockIRQ<T> where
T: Send,
T: Send,
impl<T: ?Sized> Sync for SpinLockIRQ<T> where
T: Send,
T: Send,
impl<T: ?Sized> Unpin for SpinLockIRQ<T> where
T: Unpin,
T: Unpin,
impl<T: ?Sized> UnwindSafe for SpinLockIRQ<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,