pub struct Worker { /* private fields */ }Expand description
A thread-pinned io_uring executor: the ring, a timer heap, and a local
(!Send) task set, driven by a caller-owned loop.
Create one per thread, keep it on that thread (!Send), and drive it with
block_on. Everything else reaches the worker through
Handle: UDP sockets, timers, spawned tasks. Wakes from other threads
(any Waker this worker minted) are an atomic store plus, only while the
worker is parked, one futex syscall.
Dropping the worker makes a bounded attempt to submit the SQEs its last
turn staged and drain their completions. A datagram already handed to a
udp::Socket is included in that submission attempt, while operation
storage that the kernel might still access is safely leaked if teardown
cannot finish. It runs no tasks, though, so work a task has merely been
asked for is not performed: a QUIC close is queued on its connection and
framed by the driver task, so keep driving until the close is published
rather than stopping the worker on the call that asked for it.
Implementations§
Source§impl Worker
impl Worker
Sourcepub fn new(config: Config) -> Result<Self, Error>
pub fn new(config: Config) -> Result<Self, Error>
Set up the ring, refusing kernels below Linux 6.12.
The floor buys incremental provided-buffer consumption, the absolute park timeout, and batched minimum waits with one code path; there is deliberately no fallback (use the tokio stack instead).