Function enable

Source
pub unsafe fn enable()
Expand description

Enables Compiler Interrupts.

This function enables Compiler Interrupts if it is currently disabled. Compiler Interrupts are enabled by default.

§Note

This function is thread-specific, which means it only enables on the thread they called on.

This function can be called multiple times. Number of enable calls must be the same as the number of previous disable calls to re-enable the interrupts.

§Safety

This function mutates a thread-local static variable which uses for the counter. Thread unsafety will not be introduced. Rust considers mutating static variable unsafe.

§Examples

unsafe {
    // disables the interrupts
    compiler_interrupts::disable();
}

for _ in 0..42 {
    println!("interrupts have been disabled");
}

unsafe {
    // re-enables the interrupts
    compiler_interrupts::enable();
}