Skip to main content

Module reactor

Module reactor 

Source
Expand description

Reactor: a per-task registry of fds waiting for IO.

Leaf futures that wrap an OSAL selectable handle (UDP sockets, TCP sockets, files opened O_NONBLOCK) call register_read when they return Poll::Pending. The runtime then blocks the task in OS_SelectMultiple until any registered fd becomes readable or a timeout elapses.

The reactor is installed into the Waker passed to polls by crate::runtime::Runtime. Leaf futures find it by reading the waker’s data pointer.

Structs§

Reactor
Per-task reactor state.

Functions§

register_read
Registers a read interest for id using the reactor carried in waker. No-op if the waker was not produced by a reactor-backed runtime.
register_write
Registers a write interest for id using the reactor carried in waker. No-op if the waker was not produced by a reactor-backed runtime.