boundedq

package
v0.0.0-...-9528cf9 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindNearestPowerOf2

func FindNearestPowerOf2(n uint32) uint32

Types

type BoundedQueue

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

BoundedQueue is a thread-safe bounded queue.

func NewBoundedQueue

func NewBoundedQueue(cap uint32) *BoundedQueue

NewBoundedQueue returns a new BoundedQueue instance.

func (*BoundedQueue) Cap

func (q *BoundedQueue) Cap() uint32

Len returns the capacity of the queue.

func (*BoundedQueue) Len

func (q *BoundedQueue) Len() uint32

Len returns the length of the queue.

func (*BoundedQueue) Pop

func (q *BoundedQueue) Pop(wait bool, waitTime int64) int

Pop gets and removes conn from the queue. If waitTime <= 0, which means block waiting for Pop.

func (*BoundedQueue) Push

func (q *BoundedQueue) Push(x int)

Push adds conn into the queue.

Jump to

Keyboard shortcuts

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