gchan

package
v1.5.12 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package gchan provides graceful operations for channel.

优雅的Channel操作.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chan

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

func New

func New(limit int) *Chan

func (*Chan) Close

func (q *Chan) Close()

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

func (*Chan) Pop

func (q *Chan) Pop() interface{}

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

func (*Chan) Push

func (q *Chan) Push(v interface{}) error

将数据压入队列

func (*Chan) Size

func (q *Chan) Size() int

获取当前队列大小

Jump to

Keyboard shortcuts

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