Expand description
Vyukov-style multi-producer single-consumer linked queue.
Producers enqueue with one swap on the tail; the consumer drains by
following next pointers from the head. The dangling-tail window is the
load-bearing detail: between the producer’s CAS-of-tail and the
prev.next = new link, the consumer can see next == null while there is
actually a publisher in flight. MpscQueue::try_pop returns
PopResult::Inconsistent in that window so the caller can spin or back
off rather than treating it as empty.
use subms_mpsc_queue::{MpscQueue, PopResult};
let mut q: MpscQueue<u32> = MpscQueue::new();
q.push(7);
q.push(8);
assert!(matches!(q.try_pop(), PopResult::Some(7)));
assert!(matches!(q.try_pop(), PopResult::Some(8)));Structs§
- Mpsc
Queue - Multi-producer single-consumer linked queue.
Enums§
- PopResult
- One-shot result of
MpscQueue::try_pop.