gchan

package
v1.6.0 Latest Latest
Warning

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

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

Documentation

Overview

Package gchan provides graceful channel for safe operations.

It's safe to call Chan.Push/Close functions repeatedly.

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

New creates a graceful channel with given limit.

func (*Chan) Close

func (c *Chan) Close()

Close closes the channel. It is safe to be called repeatedly.

func (*Chan) Len

func (c *Chan) Len() int

Len returns the length of the channel.

func (*Chan) Pop

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

Pop pops value from channel. If there's no value in channel, it would block to wait.

func (*Chan) Push

func (c *Chan) Push(value interface{}) error

Push pushes <value> to channel. It is safe to be called repeatedly.

func (*Chan) Size

func (c *Chan) Size() int

See Len.

Jump to

Keyboard shortcuts

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