Skip to main content

Module spmc

Module spmc 

Source
Available on non-crate feature tests_loom only.
Expand description

Single-producer, multi-consumer broadcast queue.

Every consumer observes every value the producer publishes, unless the consumer falls behind by more than CAPACITY slots, in which case the next Consumer::try_read returns a ReadResult::Lapped and jumps the read cursor to the most recently published slot.

See new for the entry point, Producer for publishing, and Consumer / ReadResult for reading.

Structs§

Consumer
A reading handle of an SPMC broadcast queue.
Options
Construction-time options for new.
Producer
The publishing handle of an SPMC broadcast queue.
Slot
One cell in the SPMC ring. Carries the payload plus a sequence number the seqlock protocol uses to detect torn or lapped reads.

Enums§

ReadResult
Outcome of a Consumer::try_read call.

Functions§

new
Creates a new SPMC broadcast queue with CAPACITY slots and NCONSUMERS pre-built Consumers.