Expand description
A wait-free single-producer single-consumer (SPSC) queue to send data to another thread. It is based on the improved FastForward queue.
§Example
use waitfree_sync::spsc;
// Type ──╮ ╭─ Capacity
let (mut tx, mut rx) = spsc::spsc::<u64>(8);
tx.try_send(234);
assert_eq!(rx.try_recv(),Some(234u64));§Behavior for full and empty queue.
If the queue is full, the Sender returns a NoSpaceLeftError.
If the queue is empty, the Receiver returns None
Structs§
- NoSpace
Left Error - Indicates that a queue is full.
- Receiver
- The receiving side of the spsc queue.
- Sender
- The sending side of the spsc queue.
Functions§
- spsc
- Create a new wait-free SPSC queue. The
capacitymust be a power of two, which is validate during runtime.