expression
Rearm a one-shot registration
A one-shot registration stops delivering further events after notification until rearmed. Application state should ensure ownership of processing and decide whether to rearm or close. The boolean model is not a kernel implementation. Expected stdout (not executed): first: true second: false rearmed: true Common mistake: Forgetting to rearm a live connection or rearming before its owner finishes processing. Run only in the isolated fixture runner, not a public code playground.
Formal Syntax & Structure
rust syntaxrust
EPOLLONESHOT; epoll_ctl(..., EPOLL_CTL_MOD, ...)Working Example
Example Snippetrust
fn deliver(armed: &mut bool, ready: bool) -> bool { if *armed && ready { *armed = false; true } else { false }}fn main() { let mut armed = true; println!("first: {}", deliver(&mut armed, true)); println!("second: {}", deliver(&mut armed, true)); armed = true; // Model a successful rearm, not a syscall. println!("rearmed: {}", deliver(&mut armed, true));}