pub struct Waker { /* private fields */ }Expand description
Cloneable handle that interrupts an in-progress EventSource::poll or
EventSource::read.
A waker is bound to one source. A pending wake ends its next wait.
Ready events, including resizes, take priority and leave the wake pending.
Without an event, EventSource::read returns Interrupted and
EventSource::poll returns false. Concurrent wake calls may coalesce.
For cancellation, set a shared flag before waking the source and check that flag after every read result, including successful events. The handle is cheap to clone and can be sent to other threads.
Implementations§
Source§impl Waker
impl Waker
Sourcepub fn wake(&self) -> Result<()>
pub fn wake(&self) -> Result<()>
Interrupt the EventSource this waker is bound to.
Ready events take priority and leave the wake pending. Without an
event, EventSource::poll returns Ok(false) and EventSource::read
returns io::ErrorKind::Interrupted. Input errors still surface.
A wake before a wait remains pending until the source services it.
The wake does not enqueue an Event or discard partial input.
EventStream retries after a wake; its next item is an event
or an error. Use a separate async signal for application cancellation.
Returns any platform error produced while signalling the wake handle.