pub struct LockFreeQueue<T> { /* private fields */ }Expand description
A lock-free multi-producer, single-consumer queue.
Multiple threads can call push() concurrently. Only one thread
should call pop() at a time (the owning CPU’s scheduler).
Implementations§
Source§impl<T> LockFreeQueue<T>
impl<T> LockFreeQueue<T>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new empty lock-free queue.
Initializes with a sentinel (dummy) node so that head and tail always point to a valid node.
Sourcepub fn push(&self, value: T)
pub fn push(&self, value: T)
Push a value onto the tail of the queue (multi-producer safe).
This operation is lock-free: it uses a CAS loop on the tail pointer. Multiple CPUs can call push() concurrently.