/PriorityQueue

Thread safe priority queue implemented in go

Primary LanguageGoMIT LicenseMIT

PriorityQueue Go Report Card GoDoc

Thread safe priority queue implemented on top of container/heap

Usage

// create a new queue
// pass true for mutex autolock
q := PriorityQueue.New(true)

// push a new element
q.Push("a", 1)
q.Push("b", 2)

// pull the element with the highest priority
first, _ := q.Pull()
// output: first is b
fmt.Println("first is ", first)

second, _ := q.Pull()
// output: second is a
fmt.Println("second is ", second)