pub enum Turn {
Ran,
Poll(Duration),
Wait(Duration),
Done,
}Expand description
What one turn of the event loop did, so the caller cannot spin by accident.
A bare bool invites the mistake of looping on it without sleeping, which burns a
core until the timer is due. Naming the three cases makes the wait explicit.
Variants§
Ran
Something ran. Call again immediately — there may be more ready work.
Poll(Duration)
Nothing is runnable, but descriptors are registered: the host must poll
Interp::pending_fds for at most this long, then report readiness with
Interp::fire_fd.
A separate variant from Turn::Wait on purpose. Sleeping instead of polling is
the failure this project treats as worst — a handler that silently never fires —
so the two cannot be confused by accident.
Wait(Duration)
Nothing is runnable yet, but something is pending. Block at most this long, then call again.
Done
Nothing is pending at all: the loop is done.