gf: github.com/johng-cn/gf/g/container/gchan Index | Files

package gchan

import "github.com/johng-cn/gf/g/container/gchan"

Package gchan provides graceful operations for channel.

优雅的Channel操作.

Index

Package Files

gchan.go

type Chan Uses

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

func New Uses

func New(limit int) *Chan

func (*Chan) Close Uses

func (q *Chan) Close()

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

func (*Chan) Pop Uses

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

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

func (*Chan) Push Uses

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

将数据压入队列

func (*Chan) Size Uses

func (q *Chan) Size() int

获取当前队列大小

Package gchan imports 2 packages (graph). Updated 2019-01-18. Refresh now. Tools for package owners.