Expand description
Lock guardian trait : determines the guard behaviour of [SpinLock].
Two built-in implementations are provided:
-
IrqDisabled– saves RFLAGS and clears IF before acquiring the lock. Use this for data shared across CPUs (heap, VFS, IPC queues, …). This corresponds to the classic Linuxspin_lock_irqsave. -
PreemptDisabled– increments the per-CPU preemption depth without touching IF. Use this for per-CPU data that is never accessed from interrupt handlers (scheduler run-queues, per-CPU frame caches, …).
The trait is sealed so that only these two implementations exist inside the kernel crate, preventing accidental misuse.
Structs§
- Guardian
State - Opaque state returned by
Guardian::enterand consumed byGuardian::exit. - IrqDisabled
- Guardian that saves RFLAGS and disables IRQs before the lock is acquired.
- Preempt
Disabled - Guardian that only disables preemption, leaving IRQs untouched.