pub trait Waitable {
// Required method
fn wait(&mut self, timeout: Option<Duration>) -> Result<bool, Error>;
}Expand description
A backend notification a thread can wait on.
A notification is an edge: the backend raises it when its completions go from none to some,
not once for each (IoBackend). So a wait returns for however many raisings came since the
last wait that saw one, and a waiter that does not drain to empty before waiting again can
wait on a completion that has already been raised for. Raisings before the first wait count.
Required Methods§
Sourcefn wait(&mut self, timeout: Option<Duration>) -> Result<bool, Error>
fn wait(&mut self, timeout: Option<Duration>) -> Result<bool, Error>
Wait for the notification to have been raised since the last wait that saw it, for up to
timeout – None is no limit and Duration::ZERO only asks. Whether it was.
§Errors
The notification’s own report, when it cannot be waited on.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Waitable for CompletionEvent
The ring’s completion event is auto-reset (the ring crate’s D-21), so a wait that sees it signalled consumes the signal, and a raising before the first wait is seen by it: the ring crate signals the event once as it attaches it (its D-20).
One waiter per ring is the caller’s to keep, as the ring crate states it: a second wait on the same event, or a duplicate of this handle waited on elsewhere, steals wakes.