Skip to main content

Module wait

Module wait 

Source
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.

StrategyLatencyCPU usageBest for
BusySpinLowest (~0 ns wakeup)100% coreDedicated, pinned cores
YieldSpinLow (~30 ns on x86)HighShared cores, SMT
BackoffSpinMedium (exponential)DecreasingBackground consumers
AdaptiveAuto-scalingVariesGeneral 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§

WaitStrategy
Strategy for blocking recv() and SubscriberGroup::recv().