Expand description
Wait strategies for blocking receive operations.
WaitStrategy controls how a consumer thread waits when no message is
available. All strategies are no_std compatible.
| Strategy | Latency | CPU usage | Best for |
|---|---|---|---|
BusySpin | Lowest (~0 ns wakeup) | 100% core | Dedicated, pinned cores |
YieldSpin | Low (~30 ns on x86) | High | Shared cores, SMT |
BackoffSpin | Medium (exponential) | Decreasing | Background consumers |
Adaptive | Auto-scaling | Varies | General purpose |
§Platform-specific optimizations
On aarch64, YieldSpin and BackoffSpin use the WFE (Wait For
Event) instruction instead of core::hint::spin_loop() (which maps to
YIELD). WFE puts the core into a low-power state until an event —
such as a cache line invalidation from the publisher’s store — wakes it.
The SEVL + WFE pattern is used: SEVL sets the local event register
so the first WFE doesn’t block unconditionally.
On x86/x86_64, core::hint::spin_loop() emits PAUSE, which is the
standard spin-wait hint (~140 cycles on Skylake+).
Enums§
- Wait
Strategy - Strategy for blocking
recv()andSubscriberGroup::recv().