Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockingQueue ¶
type BlockingQueue[T any] interface { // Enqueue pushes an item onto the queue Enqueue(item T) // Dequeue removes the first item from the queue and returns it. Dequeue() T // TryDequeue attempts to remove the first item from the queue and return it. This // method does not block, and instead, returns true if the item was available and false // otherwise TryDequeue() (T, bool) // Each blocks modification and allows iteration of the queue. Each(f func(int, T)) // Length returns the length of the queue Length() int // IsEmpty returns true if the queue is empty IsEmpty() bool // Clear empties the queue Clear() }
BlockingQueue is a queue backed by a slice which blocks if dequeueing while empty. This data structure should use a pool of worker goroutines to await work.
func NewBlockingQueue ¶
func NewBlockingQueue[T any]() BlockingQueue[T]
NewBlockingQueue returns a new BlockingQueue implementation
Click to show internal directories.
Click to hide internal directories.