stopper

package
v2.0.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stopper

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

Stopper eases the graceful termination of a group of goroutines

func NewStopper

func NewStopper() *Stopper

NewStopper initializes a new Stopper instance

func (*Stopper) Begin

func (s *Stopper) Begin()

Begin indicates that a new goroutine has started.

func (*Stopper) Chan

func (s *Stopper) Chan() chan struct{}

Chan returns the channel on which goroutines could listen to determine if they should stop. The channel is closed when Stop() is called.

func (*Stopper) End

func (s *Stopper) End()

End indicates that a goroutine has stopped.

func (*Stopper) Sleep

func (s *Stopper) Sleep(d time.Duration) bool

Sleep puts the current goroutine on sleep during a duration d Sleep could be interrupted in the case the goroutine should stop itself, in which case Sleep returns false.

func (*Stopper) Stop

func (s *Stopper) Stop()

Stop asks every goroutine to end.

Jump to

Keyboard shortcuts

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