Crate irq_safety
source ·Expand description
Types for interrupt-safe operations, i.e., avoiding deadlock when sharing data between a regular thread context and an interrupt handler context.
Key types include:
HeldInterrupts
: a guard type that auto-reenables interrupts when dropped, only if they were originally enabled when the guard was created.- [ MutexIrqSafe
] and [
RwLockIrqSafe]: spinlock wrappers that use [
spin::Mutex] and [
spin::RwLock`] internally to auto-disable interrupts for the duration of the lock being held.
Structs
- A guard type for withholding regular interrupts on the current CPU.
- This type provides interrupt-safe MUTual EXclusion based on [spin::Mutex].
- A guard to which the protected data can be accessed
- A simple wrapper around a
RwLock
whose guards disable interrupts properly - A guard to which the protected data can be read
- A guard to which the protected data can be written
Functions
- Unconditionally disables regular interrupts (IRQs), not NMIs or fast interrupts (FIQs on aarch64).
- Unconditionally enables regular interrupts (IRQs), not NMIs or fast interrupts (FIQs on aarch64).
- Prevents regular interrupts from occurring until the returned
HeldInterrupts
object is dropped. - Returns whether regular interrupts are enabled on the current CPU.