queue

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 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 CTQueue

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

CTQueue is a thread safe queue implementation which allows safe usage among different threads/go-routines and can be closed at any given time. The queue can be closed by either allowing the remaining elements to remain within or to be extracted. Once the queue is closed, no new elements may be added, but existing elements can still be popped of the queue.

func NewCTQueue

func NewCTQueue[T any]() *CTQueue[T]

func (*CTQueue[T]) Apply

func (ctq *CTQueue[T]) Apply(fn func(T))

Apply applies the given function to all items in the queue.

func (*CTQueue[T]) Close

func (ctq *CTQueue[T]) Close()

func (*CTQueue[T]) CloseAndRetrieveRemaining

func (ctq *CTQueue[T]) CloseAndRetrieveRemaining() []T

func (*CTQueue[T]) IsClosed

func (ctq *CTQueue[T]) IsClosed() bool

func (*CTQueue[T]) Len

func (ctq *CTQueue[T]) Len() int

func (*CTQueue[T]) Pop

func (ctq *CTQueue[T]) Pop() (T, bool)

func (*CTQueue[T]) Push

func (ctq *CTQueue[T]) Push(val T) bool

func (*CTQueue[T]) PushMany

func (ctq *CTQueue[T]) PushMany(val ...T) bool

func (*CTQueue[T]) TryPop

func (ctq *CTQueue[T]) TryPop() (T, bool)

TryPop attempts to pop an element of the queue, but if no elements are available it doesn't wait and exits immediately.

Jump to

Keyboard shortcuts

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