Skip to main content

Module mpmc

Module mpmc 

Source
Expand description

Multi-consumer extension: bounded MPMC ring with tail-sequence CAS.

Disruptor-style barrier: per-slot sequence numbers gate both producer claim (CAS the tail) and consumer claim (CAS the head). Multiple consumers race; the loser sees a stale head and retries with the new value. Optional MpmcQueue::cas_retries counts contention for callers wiring it through the metrics feature.

Both MpmcQueue::try_enqueue and MpmcQueue::try_dequeue are wait-free in the uncontended case and bounded-retry under contention.

Structsยง

MpmcQueue
Bounded MPMC ring queue. Capacity is rounded up to the next power of two (minimum 2).