chanutil

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 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 ChanQ

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

Flexible channel queue (no fixed length).

func NewChanQ

func NewChanQ(inSize, outSize int) *ChanQ

func (*ChanQ) In

func (ch *ChanQ) In() chan<- interface{}

func (*ChanQ) Out

func (ch *ChanQ) Out() <-chan interface{}

type NBChan

type NBChan struct {
	LogString string
	// contains filtered or unexported fields
}

Non-blocking channel.

func NewNBChan

func NewNBChan() *NBChan

func NewNBChan2 added in v1.1.0

func NewNBChan2(n int, logS string) *NBChan

func (*NBChan) NewBufChan

func (ch *NBChan) NewBufChan(n int)

func (*NBChan) Receive

func (ch *NBChan) Receive(timeout time.Duration) (interface{}, error)

Receives or fails after timeout.

func (*NBChan) Send

func (ch *NBChan) Send(v interface{}) error

Send now if a receiver is watching, or fails (non-blocking) with error.

func (*NBChan) SetBufChanToZero added in v1.1.0

func (ch *NBChan) SetBufChanToZero()

Setting the channel to zero allows a send to fail immediatly if there is no receiver waiting.

Jump to

Keyboard shortcuts

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