pub struct SharedRingMpmc;Expand description
Factory for an MPMC grid composed from N Lamport SPSC rings partitioned across M consumers.
Implementations§
Sourcepub fn create_anon_grid(
n_producers: usize,
n_consumers: usize,
capacity: usize,
) -> Result<(Vec<MpmcProducer>, Vec<MpmcConsumer>), RingError>
pub fn create_anon_grid( n_producers: usize, n_consumers: usize, capacity: usize, ) -> Result<(Vec<MpmcProducer>, Vec<MpmcConsumer>), RingError>
Anonymous in-memory MPMC grid: n_producers rings,
n_consumers consumer handles. Consumer i drains
producer rings i, i + n_consumers, i + 2*n_consumers,
and so on.
Constraints: n_consumers >= 1, n_producers >= n_consumers
(so every consumer has at least one ring; idle consumers
are a configuration smell, not a feature).
Sourcepub fn create_grid_in_region<R: RegionOwner>(
region: R,
n_producers: usize,
n_consumers: usize,
capacity: usize,
) -> Result<(Vec<MpmcProducer>, Vec<MpmcConsumer>), RingError>
pub fn create_grid_in_region<R: RegionOwner>( region: R, n_producers: usize, n_consumers: usize, capacity: usize, ) -> Result<(Vec<MpmcProducer>, Vec<MpmcConsumer>), RingError>
MPMC grid laid out in ONE caller-owned region (huge / large
pages). All n_producers SPSC lanes are carved back-to-back
from the single region, so the whole grid sits on a handful of
2 MB / 1 GB pages instead of n_producers separate small
mappings - the case where large pages actually shed TLB
pressure. The region must hold at least
spsc_ring_file_size(capacity) * n_producers bytes.
This is the per-producer-FIFO MPMC primitive on large pages;
SharedRing::create_in_region
is the global-FIFO (Vyukov) counterpart.
Sourcepub fn create_grid(
path_prefix: impl AsRef<Path>,
n_producers: usize,
n_consumers: usize,
capacity: usize,
) -> Result<(Vec<MpmcProducer>, Vec<MpmcConsumer>), RingError>
pub fn create_grid( path_prefix: impl AsRef<Path>, n_producers: usize, n_consumers: usize, capacity: usize, ) -> Result<(Vec<MpmcProducer>, Vec<MpmcConsumer>), RingError>
File-backed MPMC grid: one file per producer ring; the
file path for ring i is path_prefix.{i}.bin.