Skip to main content

Module event_ring

Module event_ring 

Source
Expand description

A bounded, wait-free single-producer / single-consumer (SPSC) ring buffer for scheduled TimedEvents.

One thread (e.g. the sequencer / loader) pushes events; one thread (the audio thread) pops them. Producer and consumer touch disjoint atomics — the producer owns tail, the consumer owns head — so neither ever blocks or allocates. One slot of the N-element buffer is kept empty to distinguish “full” from “empty”, giving a usable capacity of N - 1.

The events are all-integer Copy PODs, so the plain data writes carry no interior pointers; the Acquire/Release ordering on the indices is what publishes a written slot to the consumer. This mirrors the rtrb-style discipline the Qualia hot path uses without pulling in a dependency.

Structs§

EventRing
A fixed-capacity SPSC ring of N slots (usable capacity N - 1).