Skip to main content

wait_event

Function wait_event 

Source
pub fn wait_event(vm: &mut Vm, arm: impl FnOnce(Wake) -> bool) -> bool
Expand description

Waits for an event without blocking the thread when possible. arm(wake) must check the condition and, if it does not hold, arrange for wake to be called when it may (under the same lock as the check); it returns true if the caller must wait. Returns false if this context cannot wait cooperatively (no fibers, or a thread-keyed lock is held): the caller then blocks the thread as before. After a true return, re-check the condition.