pub struct SharedRingMpscFifo;Expand description
Factory for a single-ring MPSC pool that preserves global FIFO
ordering across all producers. Producers contend on one
Vyukov-MPMC producer_seq (CAS retries on push) while the
single consumer skips the consumer-side CAS by using the
try_pop_spsc fast path on the underlying SharedRing.
§When this beats SharedRingMpsc (the composed variant)
SharedRingMpsc is faster on the producer side for any N
because each producer owns its own ring (zero CAS contention).
SharedRingMpscFifo wins on the consumer side because the
consumer drains one ring instead of round-robining N. The
crossover depends on:
- N (producer count): low N favours
Fifo(light producer CAS contention + no consumer round-robin); high N favoursComposed(independent producer rings, no shared CAS). - ordering requirement:
Fifois the only choice when the caller needs global FIFO across all producers (e.g. a totally- ordered event log).Composedonly preserves per-producer FIFO.
examples/mpmc_shootout.rs benches both side by side at common
(N producers, 1 consumer) shapes; pick by measurement.
Implementations§
Sourcepub fn create_anon_pool(
n_producers: usize,
capacity: usize,
) -> Result<(Vec<MpscFifoProducer>, MpscFifoConsumer), RingError>
pub fn create_anon_pool( n_producers: usize, capacity: usize, ) -> Result<(Vec<MpscFifoProducer>, MpscFifoConsumer), RingError>
Anonymous in-memory single-ring MPSC pool.
Sourcepub fn create_pool(
path: impl AsRef<Path>,
n_producers: usize,
capacity: usize,
) -> Result<(Vec<MpscFifoProducer>, MpscFifoConsumer), RingError>
pub fn create_pool( path: impl AsRef<Path>, n_producers: usize, capacity: usize, ) -> Result<(Vec<MpscFifoProducer>, MpscFifoConsumer), RingError>
File-backed single-ring MPSC pool. One backing file (not
one per producer), so cross-process layout is identical to
a single SharedRing.