Expand description
Zero-copy multicast buffer for shared intermediate stages.
MulticastBuffer<T> implements a pre-allocated ring buffer with per-slot
reference counting for single-producer, multiple-consumer (SPMC) multicast.
Designed for Ring 0 hot path: zero allocations after construction.
§Design
- Pre-allocated slots with power-of-2 capacity and bitmask indexing
- Single writer via
publish(), multiple readers viaconsume() - Per-slot atomic refcount tracks outstanding consumers
- Backpressure:
publish()fails when slowest consumer hasn’t freed a slot
§Safety
The single-writer invariant is upheld by the DAG executor,
which ensures exactly one thread calls publish() on any given buffer.
Multiple threads may call consume() with distinct consumer_idx values.
Structs§
- Multicast
Buffer - Pre-allocated SPMC multicast buffer with reference-counted slots.