Expand description
Bounded SPSC ring with ypipe-style batched flush/prefetch.
Three pointers:
head: consumer read position (AtomicUsize, consumer-owned)tail: writer position (plain usize, producer-only, no atomic)flush: last flushed position (AtomicUsize, producer writes, consumer reads)
push writes to the ring with zero atomics. flush makes all
pending writes visible with one Release store. pop reads with
zero atomics. prefetch loads all flushed items with one Acquire
load. Result: 1 atomic per batch on each side.
Structs§
- Async
Consumer - Async receiving half. Implements
Stream. - Async
Producer - Async sending half. Wakes the consumer on flush when the ring was empty.
- Consumer
- Receiving half.
Sendbut notSync. - Producer
- Sending half.
Sendbut notSync.
Enums§
- Flush
Result - Result of a flush operation.
Functions§
- async_
spsc - Create an async bounded SPSC ring with the given capacity (rounded up to next power of two).
- spsc
- Create a bounded SPSC ring with the given capacity (rounded up to next power of two).