channel

package
v0.0.0-...-5a37ffa Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChanN

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

ChanN 顾名思义,是一次可以发送,接收N个数据的chan,特性和原生的chan类似 通过原生chan实现Recv()的阻塞!写数据只覆盖,不阻塞!

func NewChanN

func NewChanN(cap int) *ChanN

func (*ChanN) Close

func (p *ChanN) Close()

func (*ChanN) Read

func (p *ChanN) Read(datas []interface{}, block int) (ln int, closed bool)

out_ms 读超时的时间, 单位毫秒 Millisecond

func (*ChanN) Recv

func (p *ChanN) Recv(n int, block int) (result []interface{}, closed bool)

out_ms 读超时的时间, 单位毫秒 Millisecond

func (*ChanN) Send

func (p *ChanN) Send(data interface{}) (full bool, closed bool)

func (*ChanN) SendCover

func (p *ChanN) SendCover(data interface{}) (full bool, closed bool)

func (*ChanN) SendCoverN

func (p *ChanN) SendCoverN(datas []interface{}) (n int, closed bool)

func (*ChanN) SendN

func (p *ChanN) SendN(datas []interface{}) (n int, closed bool)

type IChanN

type IChanN interface {
	Send(data interface{}) (full bool, closed bool)
	SendN(datas []interface{}) (n int, closed bool)
	Recv(n int, block int) (result []interface{}, closed bool)
	Read(datas []interface{}, block int) (n int, closed bool)
	Close()
}

IChanN 用于IO和逻辑层之间传递数据可以用原生封装,也可以新建 要求:发送不阻塞,而且缓冲满了之后,要求覆盖旧的数据; 接收可选择是否阻塞

Jump to

Keyboard shortcuts

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