expression
Keep interrupt work bounded with a handoff model
An interrupt handler often acknowledges its source and defers longer processing to a task. This single-owner model coalesces events into a flag, deliberately losing event multiplicity. It is not an interrupt handler and provides no synchronization; use a suitable atomic or critical section when sharing real state. Expected host stdout (not executed): work: true, again: false Common mistake: Using a boolean when every event must be counted, or assuming a normal mutable reference can be shared across interrupt contexts.
Formal Syntax & Structure
rust syntaxrust
pending flag + foreground processingWorking Example
Example Snippetrust
#![no_std]pub struct Pending(bool);impl Pending { pub const fn new() -> Self { Self(false) } pub fn signal(&mut self) { self.0 = true; } pub fn take(&mut self) -> bool { core::mem::replace(&mut self.0, false) }}