pub fn disable_local() -> DisabledLocalIrqGuardExpand description
Disables all IRQs on the current CPU (i.e., locally).
This function returns a guard object, which will automatically enable local IRQs again when it is dropped. This function works correctly even when it is called in a nested way. The local IRQs shall only be re-enabled when the most outer guard is dropped.
This function can play nicely with SpinLock as the type uses this function internally.
One can invoke this function even after acquiring a spin lock. And the reversed order is also ok.
ยงExamples
use ostd::irq;
let guard = irq::disable_local();
// Do something with IRQs disabled.
work_with_irq_disabled();
// Re-enable IRQs if they were previously enabled.
drop(guard);