Documentation
¶
Overview ¶
Package mpsc provides an efficient implementation of a multi-producer, single-consumer lock-free queue.
The Push function is safe to call from multiple goroutines. The Pop and Empty APIs must only be called from a single, consumer goroutine.
The Push function is safe to call from multiple goroutines. The Pop and Empty APIs must only be called from a single, consumer goroutine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CQueue ¶
type CQueue struct {
// contains filtered or unexported fields
}
CQueue is a concurrent unbounded queue which uses two-Lock concurrent queue qlgorithm.
type MpscQueue ¶
type MpscQueue struct {
// contains filtered or unexported fields
}
func NewMpscQueue ¶
func NewMpscQueue() *MpscQueue
func (*MpscQueue) Empty ¶
Empty returns true if the queue is empty
Empty must be called from a single, consumer goroutine
func (*MpscQueue) Pop ¶
func (q *MpscQueue) Pop() interface{}
Pop removes the item from the front of the queue or nil if the queue is empty
Pop must be called from a single, consumer goroutine
type Queue ¶
Queue is a FIFO data structure. Push puts a value into its tail, Pop removes a value from its head.