Function x86_64::instructions::interrupts::without_interrupts[][src]

pub fn without_interrupts<F, R>(f: F) -> R where
    F: FnOnce() -> R, 

Run a closure with disabled interrupts.

Run the given closure, disabling interrupts before running it (if they aren't already disabled). Afterwards, interrupts are enabling again if they were enabled before.

If you have other enable and disable calls within the closure, things may not work as expected.

Examples

// interrupts are enabled
without_interrupts(|| {
    // interrupts are disabled
    without_interrupts(|| {
        // interrupts are disabled
    });
    // interrupts are still disabled
});
// interrupts are enabled again