Struct std::LFQueue
generic<T> struct LFQueue {
[]T buffer;
unsigned long cap;
long long head;
long long tail;
int owned;
}Fields
the slots (empty after destroy or a failed new)
power of two, <= buffer.len
elements ever enqueued (producer, atomic)
elements ever dequeued (consumer, atomic)
1 if LFQueue::new allocated the buffer
Methods
Uses a caller-provided buffer (which must outlive the queue); its length is rounded DOWN to a power of two for the capacity.
Allocates its own buffer; cap is rounded UP to a power of two. A failed allocation yields a queue with cap 0 (every enqueue reports full).
1 on success, 0 if full
null if empty
frees the buffer if LFQueue::new allocated it
= drop()