pub enum WaitStrategy {
BusySpin,
YieldSpin,
BackoffSpin,
Adaptive {
spin_iters: u32,
yield_iters: u32,
},
}Expand description
Wait strategy for blocking recv() on shared-memory subscriptions.
Controls how the subscriber waits when no new sample is available.
The spin/yield phases use platform-specific hints; the OS phase uses
futex (Linux), WaitOnAddress (Windows), or WFE (macOS/aarch64).
Variants§
BusySpin
Pure busy-spin. No hint instruction. Minimum wakeup latency but consumes 100% of one CPU core. Use on dedicated, pinned cores.
YieldSpin
PAUSE (x86) or SEVL+WFE (aarch64) per iteration. Yields the CPU
pipeline to the SMT sibling and reduces power vs BusySpin.
BackoffSpin
Exponential backoff with platform yield hint. Starts with bare spins, then escalates to PAUSE/WFE-based spins with increasing delays. Good for consumers that may be idle for extended periods.
Adaptive
Three-phase: bare spin -> yield -> OS sleep. Default.
Phase 1: bare spin for spin_iters iterations (fastest wakeup).
Phase 2: PAUSE/WFE spin for yield_iters iterations.
Phase 3: OS-assisted sleep (futex/WaitOnAddress/WFE).
Trait Implementations§
Source§impl Clone for WaitStrategy
impl Clone for WaitStrategy
Source§fn clone(&self) -> WaitStrategy
fn clone(&self) -> WaitStrategy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more