Expand description
Deterministic startup/shutdown helpers (readiness + stop coordination). Deterministic startup/shutdown building blocks.
These helpers are intentionally lightweight and backend-agnostic.
Patterns covered:
- readiness gating (aggregate multiple components into one “ready” latch)
- stop flag fanout to threads
- recording the first fatal error (root cause) and requesting stop
Notes on router ordering:
- request stop (set the shared stop flag)
- let stages exit / optionally drain
- stop routers and
join()them (so routing loops terminate deterministically)
Notes on drain windows:
- when stop is requested, you may choose to keep running a stage loop for a bounded
duration (e.g.
Instant::now() < deadline) to flush in-flight messages.
Structs§
- Readiness
Gate - Aggregates multiple components into a single readiness latch.
- Readiness
Token - A per-component handle used to mark startup progress.
- Root
Cause - Captures the first fatal error and coordinates process-wide stop.