synth/arm/lock.h

16 lines
256 B
C
Raw Normal View History

2022-05-17 03:56:25 +00:00
#pragma once
#include "aum1_cm1.h"
struct InterruptLock {
bool was_locked;
2022-05-17 17:17:56 +00:00
InterruptLock() : was_locked(__get_PRIMASK() != 0) { __disable_irq(); }
2022-05-17 03:56:25 +00:00
~InterruptLock() {
if (!was_locked) {
__enable_irq();
}
}
};