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