Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FastMPMCQueue ¶
type FastMPMCQueue[T any] struct { // contains filtered or unexported fields }
FastMPMCQueue is a bounded, lock‑free multi‑producer/multi‑consumer queue.
func New ¶
func New[T any](capacity uint64) *FastMPMCQueue[T]
New creates a new FastMPMCQueue with the given capacity. If the capacity is not a power of 2, it is rounded up.
func (*FastMPMCQueue[T]) Dequeue ¶
func (q *FastMPMCQueue[T]) Dequeue() (T, bool)
Dequeue removes and returns a value from the queue. If the queue is empty, it returns the zero value and false.
func (*FastMPMCQueue[T]) Enqueue ¶
func (q *FastMPMCQueue[T]) Enqueue(val T)
Enqueue inserts a value into the queue. It busy-waits until a slot becomes available.
func (*FastMPMCQueue[T]) FreeSlots ¶
func (q *FastMPMCQueue[T]) FreeSlots() uint64
FreeSlots returns an approximate count of free slots in the queue.
func (*FastMPMCQueue[T]) UsedSlots ¶
func (q *FastMPMCQueue[T]) UsedSlots() uint64
UsedSlots returns an approximate count of occupied slots.
Click to show internal directories.
Click to hide internal directories.