-
Notifications
You must be signed in to change notification settings - Fork 1
anisus/queue
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
PACKAGE package queue import "github.com\anisus\queue" Package queue implements a non-blocking concurrent first-in-first-out queue algorithm as described in the paper: Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms \Lambda Maged M. Michael Michael L. Scott Department of Computer Science University of Rochester Rochester, NY 14627-0226 fmichael,scottg@cs.rochester.edu http://www.cs.rochester.edu/u/scott/papers/1996_PODC_queues.pdf The original paper uses a counter and a CAS2 instruction to avoid the ABA problem. Since CAS2 instructions is not available in Go, the package uses a hack similar to that used in Microsoft Invisible Computing: http://research.microsoft.com/en-us/um/redmond/projects/invisible/src/queue/queue.c.htm TYPES type Queue struct { // contains filtered or unexported fields } func New() *Queue New returns an initialized queue func (q *Queue) Dequeue() (value interface{}, ok bool) Dequeue returns the value at the head of the queue and true, or if the queue is empty, it returns a nil value and false func (q *Queue) Enqueue(value interface{}) Enqueue inserts the value at the tail of the queue
About
A non-blocking concurrent first-in-first-out queue package
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published