Function nested

Source
pub unsafe fn nested<F, R>(f: F) -> R
where F: FnOnce() -> R,
Expand description

Execute closure f with interrupts enabled in the current hart (supervisor mode). This method is assumed to be called within an interrupt handler, and allows nested interrupts to occur. After the closure f is executed, the sstatus and sepc registers are properly restored to their previous values.

ยงSafety

  • Do not call this function inside a critical section.
  • This method is assumed to be called within an interrupt handler.
  • Make sure to clear the interrupt flag that caused the interrupt before calling this method. Otherwise, the interrupt will be re-triggered before executing f.