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

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.