Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ChannelQueue ¶
type ChannelQueue chan interface{}
func NewChannelQueue ¶
func NewChannelQueue(capacity int) ChannelQueue
func (ChannelQueue) Empty ¶
func (cq ChannelQueue) Empty() bool
func (ChannelQueue) Len ¶
func (cq ChannelQueue) Len() int
type PriorityQueue ¶
type PriorityQueue struct {
// contains filtered or unexported fields
}
func NewPriorityQueue ¶
func NewPriorityQueue(comparePriority func(a, b interface{}) bool, sizeHint ...int) *PriorityQueue
Function comparePriority reports whether the element a has higher priority than the element b.
func (*PriorityQueue) Empty ¶
func (pq *PriorityQueue) Empty() bool
func (*PriorityQueue) Len ¶
func (pq *PriorityQueue) Len() int
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() interface{}
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(item interface{})
type RingQueue ¶
type RingQueue struct {
// contains filtered or unexported fields
}
RingQueue is a bounded MPMC ring buffer queue that achieves concurrency with CAS operations only.
func NewRingQueue ¶
NewRingQueue will allocate a RingQueue with the specified capacity. The `spin` specifies the waiting strategy when operation will be blocked: if true, spin on CAS; otherwise, wait on channel for notification.
func (*RingQueue) Pop ¶
Push will return the next item in the queue. If the queue is empty, block until an item can be returned. If a nonzero timeout is specified, block no more than the timeout duration and return ErrTimeout. If timeout is zero, immediately return ErrEmpty.