ccu

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CQueue

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

CQueue is a lock-free (CAS) unbounded queue. https://www.cs.rochester.edu/u/scott/papers/1996_PODC_queues.pdf

func NewCQueue

func NewCQueue() *CQueue

NewCQueue returns an empty queue.

func (*CQueue) Clear

func (q *CQueue) Clear()

Clear clears the container

func (*CQueue) IsEmpty

func (q *CQueue) IsEmpty() bool

IsEmpty returns true if the container length == 0

func (*CQueue) Peek

func (q *CQueue) Peek() (T, bool)

Peek Retrieves, but does not remove, the head of this queue, or returns (nil, false) if this queue is empty.

func (*CQueue) Poll

func (q *CQueue) Poll() (T, bool)

Poll Retrieves and removes the head of this queue, or returns (nil, false) if this queue is empty.

func (*CQueue) Push

func (q *CQueue) Push(vs ...T)

Push adds items of vs to the tail of queue

type LQueue

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

LQueue is a concurrent unbounded queue which uses two-Lock concurrent queue qlgorithm.

func NewLQueue

func NewLQueue() *LQueue

NewLQueue returns an empty LQueue.

func (*LQueue) Clear

func (q *LQueue) Clear()

Clear clears the container

func (*LQueue) IsEmpty

func (q *LQueue) IsEmpty() bool

IsEmpty returns true if the container length == 0

func (*LQueue) Peek

func (q *LQueue) Peek() (T, bool)

Peek Retrieves, but does not remove, the head of this queue, or returns (nil, false) if this queue is empty.

func (*LQueue) Poll

func (q *LQueue) Poll() (T, bool)

Poll Retrieves and removes the head of this queue, or returns (nil, false) if this queue is empty.

func (*LQueue) Push

func (q *LQueue) Push(vs ...T)

Push adds items of vs to the tail of queue

type T

type T = any

T type alias of any

type UnboundedChan

type UnboundedChan struct {
	In  chan<- T // channel for write
	Out <-chan T // channel for read
	// contains filtered or unexported fields
}

UnboundedChan unbounded channel

func NewUnboundedChan

func NewUnboundedChan(initCapacity int) UnboundedChan

NewUnboundedChan create a unbounded channel

func (UnboundedChan) BufLen

func (ubc UnboundedChan) BufLen() int

BufLen returns len of the buffer.

func (UnboundedChan) Clear

func (ubc UnboundedChan) Clear()

Clear clears the container

func (UnboundedChan) Close

func (ubc UnboundedChan) Close()

Close Close the In channel

func (UnboundedChan) IsEmpty

func (ubc UnboundedChan) IsEmpty() bool

IsEmpty returns true if the container length == 0

func (UnboundedChan) Len

func (ubc UnboundedChan) Len() int

Len returns len of Out plus len of buffer.

func (UnboundedChan) Poll

func (ubc UnboundedChan) Poll() (v T, ok bool)

Poll Retrieves and removes the head of this queue, or returns (nil, false) if this queue is empty.

func (UnboundedChan) Push

func (ubc UnboundedChan) Push(vs ...T)

Push adds items of vs to the tail of queue

Jump to

Keyboard shortcuts

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