Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LockfreeQueue ¶
type LockfreeQueue struct {
// contains filtered or unexported fields
}
LockfreeQueue is a goroutine-safe Queue implementation. The overall performance of LockfreeQueue is much better than List+Mutex(standard package).
func NewLockfreeQueue ¶
func NewLockfreeQueue() *LockfreeQueue
NewLockfreeQueue is the only way to get a new, ready-to-use LockfreeQueue.
Example:
lfq := queue.NewLockfreeQueue() lfq.Push(100) v := lfq.Pop()
func (*LockfreeQueue) Pop ¶
func (lfq *LockfreeQueue) Pop() interface{}
Pop returns (and removes) an element from the front of the queue, or nil if the queue is empty. It performs about 100% better than list.List.Front() and list.List.Remove() with sync.Mutex.
func (*LockfreeQueue) Push ¶
func (lfq *LockfreeQueue) Push(val interface{})
Push inserts an element to the back of the queue. It performs exactly the same as list.List.PushBack() with sync.Mutex.
Click to show internal directories.
Click to hide internal directories.