pub struct RingEventFd { /* private fields */ }Expand description
Process-local fd readiness for one shared Orbit ring.
Every subscribing process creates its own instance. A small driver thread
parks on the ring’s generation, counting itself in the ring header while
it is parked, and marks this fd readable when the generation moves. It
then waits for its consumer to drain before it parks
again. A publisher using Fleet::publish_notified bumps
the generation and wakes only when a driver is parked: while every reader
is busy draining, a publish is a write and an atomic, with no syscall.
Multiple publishes coalesce into one wake.
The fd is backed by an eventfd on Linux and FreeBSD and by a nonblocking
pipe on macOS, where native readiness needs 14.4 or later; older systems
return ErrorKind::Unsupported from construction so callers can poll.
The contract: drain the fd, then poll the ring through your own cursor. Draining is what lets the driver park.
Clear the reactor’s readiness before draining, not after. The driver
signals once per drain: a signal that arrives just after drain
is the only one until the next drain, and a reactor that clears readiness
after draining (tokio’s clear_ready) erases it — the consumer then waits
for an edge that never comes, and the driver for a drain that never
happens.