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.
Click to show internal directories.
Click to hide internal directories.