casqueue

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CasQueue

type CasQueue[T any] struct {
	// contains filtered or unexported fields
}

CasQueue is a lock-free (CAS) unbounded queue. https://www.cs.rochester.edu/u/scott/papers/1996_PODC_queues.pdf

func NewCasQueue

func NewCasQueue[T any]() *CasQueue[T]

NewCasQueue returns an empty queue.

func (*CasQueue[T]) Clear

func (q *CasQueue[T]) Clear()

Clear clears the container

func (*CasQueue[T]) IsEmpty

func (q *CasQueue[T]) IsEmpty() bool

IsEmpty returns true if the container length == 0

func (*CasQueue[T]) Peek

func (q *CasQueue[T]) Peek() (T, bool)

Peek Retrieves, but does not remove, the head of this queue, or returns (nil, false) if this queue is empty.

func (*CasQueue[T]) Poll

func (q *CasQueue[T]) Poll() (T, bool)

Poll Retrieves and removes the head of this queue, or returns (nil, false) if this queue is empty.

func (*CasQueue[T]) Push

func (q *CasQueue[T]) Push(vs ...T)

Push adds items of vs to the tail of queue

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL