queue

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package queue implements a generic, thread-safe, bounded queue using single lock and a circular buffer, dynamically sized. CONSIDER: a lock-free implementation might perform better.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcurrentBoundedQueue

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

func NewConcurrentBoundedQueue

func NewConcurrentBoundedQueue[T any](capacity int) *ConcurrentBoundedQueue[T]

func (*ConcurrentBoundedQueue[T]) Dequeue

func (q *ConcurrentBoundedQueue[T]) Dequeue() (T, bool)

func (*ConcurrentBoundedQueue[T]) Enqueue

func (q *ConcurrentBoundedQueue[T]) Enqueue(v T)

func (*ConcurrentBoundedQueue[T]) NewData

func (q *ConcurrentBoundedQueue[T]) NewData() <-chan struct{}

NewData returns a channel that exposes a new value whenever the queue goes from empty to having some data. ONLY ONE CONSUMING GOROUTINE should use this channel.

Jump to

Keyboard shortcuts

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