queue

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LKQueue

type LKQueue struct {
	// contains filtered or unexported fields
}

LKQueue 无边界的cas锁

func NewLKQueue

func NewLKQueue() *LKQueue

NewLKQueue 返回一个空的LKQueue

func (*LKQueue) Dequeue

func (q *LKQueue) Dequeue() interface{}

Dequeue 出队,如果队列是空,则返回nil

func (*LKQueue) Enqueue

func (q *LKQueue) Enqueue(v interface{})

Enqueue 使v入队

func (*LKQueue) IsEmpty

func (q *LKQueue) IsEmpty() bool

type SliceQueue

type SliceQueue struct {
	// contains filtered or unexported fields
}

SliceQueue is an unbounded queue which uses a slice as underlying.

func NewSliceQueue

func NewSliceQueue(n int) (q *SliceQueue)

NewSliceQueue returns an empty queue. You can give a initial capacity.

func (*SliceQueue) Dequeue

func (q *SliceQueue) Dequeue() interface{}

Dequeue removes and returns the value at the head of the queue. It returns nil if the queue is empty.

func (*SliceQueue) Enqueue

func (q *SliceQueue) Enqueue(v interface{})

Enqueue puts the given value v at the tail of the queue.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL