stopper

package
v0.0.0-...-d95a457 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChanStopper

type ChanStopper struct {
	sync.Mutex
	Chan chan struct{}
	// contains filtered or unexported fields
}

ChanStopper implements the Stopper interface for users that loop over a select block

func NewChanStopper

func NewChanStopper() *ChanStopper

func (*ChanStopper) Done

func (s *ChanStopper) Done() bool

func (*ChanStopper) Finish

func (s *ChanStopper) Finish()

func (*ChanStopper) OnDone

func (s *ChanStopper) OnDone(f func())

func (*ChanStopper) Stop

func (s *ChanStopper) Stop()

type Stopper

type Stopper interface {
	// Stop asks the stoppee to stop its goroutines.
	Stop()
	// OnDone registers a callback to be fired once the stop is complete.
	OnDone(func())
	// Finish is called by the stoppee when it has shut down.
	Finish()
	// Done returns true only after Done has been called.
	Done() bool
}

Stopper is an embeddable interface for objects ("stoppees") which have goroutines that need to be stopped at the object's owner's request.

Jump to

Keyboard shortcuts

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