pub fn critical<F, R>(f: F) -> R
where
    F: FnOnce() -> R,
{
    struct Reset;

    impl Drop for Reset {
        fn drop(&mut self) {
            execution(|execution| {
                execution.unset_critical();
            });
        }
    }

    let _reset = Reset;

    execution(|execution| {
        execution.set_critical();
    });

    f()
}
/// Critical section, may not branch.
Critical section, may not branch.
Critical section may not branch .
pub fn critical<F, R>(f: F) -> R
where
    F: FnOnce() -> R,
{
    struct Reset;
    impl Drop for Reset {
        fn drop(&mut self) {
            execution(|execution| {
                execution.unset_critical();
            });
        }
    }
    let _reset = Reset;
    execution(|execution| {
        execution.set_critical();
    });
    f()
}
pub fn critical < F , R > ( f : F ) -> R where F : FnOnce ( ) -> R , { struct Reset ; impl Drop for Reset { fn drop ( & mut self ) { execution ( | execution | { execution . unset_critical ( ) ; } ) ; } } let _reset = Reset ; execution ( | execution | { execution . set_critical ( ) ; } ) ; f ( ) }
Critical section, may not branch.
Critical section may not branch .
f
F
f
F