Documentation
¶
Overview ¶
Package queue provides a queue for running tasks concurrently up to a certain limit.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler func(interface{})
Handler is a function that takes any value, and is called every time a task is processed from the queue
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is the queue Queue also has the members Handler and ConcurrencyLimit which can be set at anytime
func NewQueue ¶
NewQueue must be called to initialize a new queue. The first argument is a Handler The second argument is an int which specifies how many operation can run in parallel in the queue, zero means unlimited.
func (*Queue) Len ¶
Count returns the number of currently executing tasks and the number of tasks waiting to be executed
func (*Queue) Push ¶
func (q *Queue) Push(val interface{})
Push pushes a new value to the end of the queue