queue

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package queue provides a bounded channel-based queue.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

type Queue struct {
	PoolSize int
	PoolChan chan interface{}
}

Queue is a bounded channel-based queue.

func NewQueue

func NewQueue(size int) *Queue

NewQueue creates a new Queue with the given capacity.

func (*Queue) Exchange

func (this *Queue) Exchange(num int) (add int)

Exchange resizes the queue for reuse. Returns the number of items that can be added.

func (*Queue) Init

func (this *Queue) Init(size int) *Queue

Init reinitializes the Queue with a new capacity.

func (*Queue) Pull

func (this *Queue) Pull() interface{}

Pull removes and returns an item from the queue.

func (*Queue) Push

func (this *Queue) Push(i interface{}) bool

Push adds an item to the queue. Returns false if the queue is full.

func (*Queue) PushSlice

func (this *Queue) PushSlice(s []interface{})

PushSlice adds all items from the slice to the queue.

Jump to

Keyboard shortcuts

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