myqueue

package
v0.0.0-...-feaac18 Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 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 MyQueue

type MyQueue struct {
	sync.Mutex
	// contains filtered or unexported fields
}

MyQueue queue

func New

func New() *MyQueue

New 创建

func (*MyQueue) Close

func (q *MyQueue) Close()

Close MyQueue After close, Pop will return nil without block, and TryPop will return v=nil, ok=True

func (*MyQueue) Len

func (q *MyQueue) Len() int

获取队列长度

func (*MyQueue) Pop

func (q *MyQueue) Pop() (v interface{})

Pop 取出队列,(阻塞模式)

func (*MyQueue) Push

func (q *MyQueue) Push(v interface{})

插入队列,非阻塞

func (*MyQueue) TryPop

func (q *MyQueue) TryPop() (v interface{}, ok bool)

试着取出队列(非阻塞模式)返回ok == false 表示空

func (*MyQueue) Wait

func (q *MyQueue) Wait()

Wait 等待队列消费完成

Jump to

Keyboard shortcuts

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