gfreequeue is simple lock-free queue written in golang. this queue is goroutine-safe.
Go (>= 1.8)
go get github.com/hlts2/gfreequeue
Enqueu is Enqueu(value interface{})
, so you can enqueu any type of object
q := New()
q.Enqueue(1)
q.Enqueue(2)
q.Enqueue(3)
q.Dequeue() // 1
q.Dequeue() // 2
q.Dequeue() // 3
q := New()
q.Enqueue(1)
q.Enqueue(2)
q.Enqueue(3)
q.Iterator() // [1, 2, 3]
/*
for _, v := range q.Iterator() {
fmt.Println(v)
}
*/
gfreequeue vs lfreequeue vs lane
gfreequeue released under MIT license, refer LICENSE file.