gqueue

package
v2021.513.1742+incompa... Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

并发安全的动态队列. 优点: 1、队列初始化速度快; 2、可以向队头/队尾进行Push/Pop操作;

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

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

func New

func New(limit ...int) *Queue

队列大小为非必须参数,默认不限制

func (*Queue) Close

func (q *Queue) Close()

关闭队列(通知所有通过Pop*阻塞的协程退出)

func (*Queue) PopBack

func (q *Queue) PopBack() interface{}

从队尾先进先出地从队列取出一项数据,当没有数据可获取时,阻塞等待

func (*Queue) PopFront

func (q *Queue) PopFront() interface{}

从队头先进先出地从队列取出一项数据,当没有数据可获取时,阻塞等待

func (*Queue) PushBack

func (q *Queue) PushBack(v interface{}) error

将数据压入队列, 队尾

func (*Queue) PushFront

func (q *Queue) PushFront(v interface{}) error

将数据压入队列, 队头

func (*Queue) Size

func (q *Queue) Size() int

获取当前队列大小

Jump to

Keyboard shortcuts

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