stop

package
v0.0.0-...-821cfb7 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2018 License: MIT Imports: 2 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 <-chan struct{}

Chan is a receive-only channel

type Group

type Group struct {
	sync.WaitGroup
	// contains filtered or unexported fields
}

Stopper extends sync.WaitGroup to add a convenient way to stop running goroutines

func New

func New(parent ...*Group) *Group

New allocates and returns a new instance. Use New(parent) to create an instance that is stopped when parent is stopped.

func (*Group) Ch

func (s *Group) Ch() Chan

Ch returns a channel that will be closed when Stop is called.

func (*Group) Child

func (s *Group) Child() *Group

Child returns a new instance that will be stopped when s is stopped.

func (*Group) Stop

func (s *Group) Stop()

Stop signals any listening processes to stop. After the first call, Stop() does nothing.

func (*Group) StopAndWait

func (s *Group) StopAndWait()

StopAndWait is a convenience method to close the channel and wait for goroutines to return.

type Stopper

type Stopper = Group

Jump to

Keyboard shortcuts

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