Function avr_device::interrupt::restore
source · pub unsafe fn restore(irq_flag: IrqFlag)
Expand description
Restore the global interrupt flag to its previous state before crate::interrupt::disable_save.
Hint: Most of the time you probably don’t want to use this function directly. Consider creating a critical section with crate::interrupt::free instead.
This function is an optimization fence. That means memory accesses will not be re-ordered by the compiler across this function call.
§Safety
- If you call this function inside of a crate::interrupt::free critical section, the corresponding crate::interrupt::disable_save must also be in the same critical section.
- If you nest multiple crate::interrupt::disable_save + crate::interrupt::restore sequences, the crate::interrupt::restore must be called in the reverse order of the crate::interrupt::disable_save call order. That means the first saved IrqFlag must be restored last.