[][src]Function sunrise_kernel::i386::instructions::interrupts::without_interrupts

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

Run a closue 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 sti and cli calls within the closure, things may not work as expected.

Examples

This example is not tested
// interrupts are enabled
without_interrupts(|| {
    // interrupts are disabled
    without_interrupts(|| {
        // interrupts are disabled
    });
    // interrupts are still disabled
});
// interrupts are enabled again