pub struct Producer<'a> { /* private fields */ }Expand description
The sole incrementing handle for a CountedSignal.
This handle is Send + !Sync. Its exclusivity is what keeps exact
saturation wrap-free with a fixed source-level sequence on every path —
the sentinel re-read is a no-op RMW, never an algorithmic retry loop.
The load-bearing !Sync property is pinned at compile time:
use ph_eventing::counted_signal::Producer;
fn assert_sync<T: Sync>() {}
assert_sync::<Producer<'static>>();Implementations§
Source§impl Producer<'_>
impl Producer<'_>
Sourcepub fn increment(&self)
pub fn increment(&self)
Record one occurrence.
Below u32::MAX this is one Relaxed load and one Relaxed fetch_add.
An observed u32::MAX is re-read through a no-op RMW (fetch_or(0)):
MAX confirms saturation (skip), anything else is a post-take epoch
and one fetch_add records the occurrence. Under sole-producer
ownership the consumer’s swap(0) is the only competing write, so
every path is a fixed sequence of source-level atomics with no
algorithmic retry, and the counter never wraps. On exclusive-monitor
Arm each single RMW is an LDREX/STREX pair that repeats only if an
intervening event (an interrupt, or that swap) claims the word —
contention-bounded hardware retry, disclosed in contract B1; the
measured rows are the uncontended realisations.