interruptsafety
Interrupt safety is a property of code and interfaces that ensures correct behavior when execution may be interrupted by hardware or software interrupts. It is a concern in systems where an interrupt service routine (ISR) can preempt normal execution and access shared data or resources. An interrupt-safe function is one that can be invoked from an ISR or from normal thread context without causing data corruption or system instability. In practice this means the function completes quickly, does not block, and uses only reentrant or atomic operations.
Key requirements include avoiding blocking calls, memory allocation, and I/O within interrupt context; using atomic or
Common techniques are to use atomic operations for simple updates, disable interrupts only briefly around shared-state
Interrupt safety is related to, but distinct from, thread safety. A function can be interrupt-safe yet not