pub struct IrqMutex<T> {
data: UnsafeCell<T>,
locked: AtomicBool,
}Expand description
Spinlock for data shared between normal kernel code and interrupt handlers; disables interrupts while held to avoid self-deadlock.
Fields§
§data: UnsafeCell<T>§locked: AtomicBoolImplementations§
Source§impl<T> IrqMutex<T>
impl<T> IrqMutex<T>
Sourcepub fn lock(&self) -> IrqMutexGuard<'_, T>
pub fn lock(&self) -> IrqMutexGuard<'_, T>
Acquire the lock, disabling interrupts first. Returns a guard that restores IF on drop.
Sourcepub unsafe fn force_unlock(&self)
pub unsafe fn force_unlock(&self)
Release the lock without restoring the interrupt flag, for use in panic paths.
§Safety
Calling this while a live IrqMutexGuard still exists creates two concurrent
accessors to the protected data. Only call from a panic handler that halts the
CPU immediately after and never touches the data through the mutex again.