suspendchan

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chan

type Chan[T any] struct {
	// contains filtered or unexported fields
}

Chan is a wrapper around a channel. Underlying chan must be accessed with ReceiveC method. If the Chan is suspended, ReceiveC will return nil which makes the receiver to block on the Chan.

func New

func New[T any](buflen int) *Chan[T]

New returns a new Chan.

func (*Chan[T]) ReceiveC

func (c *Chan[T]) ReceiveC() chan T

ReceiveC returns the underlying channel for receiving values. If the channel is suspended, it returns nil.

func (*Chan[T]) Resume

func (c *Chan[T]) Resume()

Resume the channel. Reverts previous suspend operation.

func (*Chan[T]) SendC

func (c *Chan[T]) SendC() chan T

SendC returns the underlying channel for sending values.

func (*Chan[T]) Suspend

func (c *Chan[T]) Suspend()

Suspend the channel.

Jump to

Keyboard shortcuts

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