Documentation
¶
Overview ¶
Package queue provides different thread-safe generic queue implementations.
The blocking waits for the queue have elements available before retrieving from it. The blocking queue can be reset in order to make all elements available again.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Blocking ¶
type Blocking[T any] struct { // contains filtered or unexported fields }
Blocking provides a read-only queue for a list of T.
It provides a Take method for popping elements from the queue head (FIFO). If there are no elements available the Take method blocks until Reset is called.
Reset refills the elements queue.
func NewBlocking ¶
NewBlocking returns an initialized Blocking Queue.
func (*Blocking[T]) Peek ¶ added in v0.3.0
func (q *Blocking[T]) Peek() T
Peek returns but does not remove the element at the head of the queue.
func (*Blocking[_]) Reset ¶
func (q *Blocking[_]) Reset()
Reset notifies every blocking Take routine that index can be reset. nolint: revive // line too long inspiration from pre go 1.18(generics) code: https://gist.github.com/zviadm/c234426882bfc8acba88f3503edaaa36#file-cond2-go-L54