queue

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

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

Queue is a thread-safe queue.

Unlike a Go channel, Queue doesn't have any constraints on how many elements can be in the queue.

func (*Queue[T]) Pop

func (q *Queue[T]) Pop(ctx context.Context) (elem T, err error)

Pop removes the element from the front of the queue and returns it. It blocks if the queue is empty. It returns an error if the passed-in context is canceled.

func (*Queue[T]) Push

func (q *Queue[T]) Push(elem T)

Push places elem at the back of the queue.

Jump to

Keyboard shortcuts

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