Documentation
¶
Overview ¶
Package terminator permits orderly stopping / shutdown of a group of goroutines via methods which mimic stop of a sync.WaitGroup.There is a default Terminator accessible through top level functions (Add, Done, Wait and so on) that call the corresponding Terminator methods
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Terminator ¶
type Terminator struct {
// contains filtered or unexported fields
}
Terminator manages groups of goroutines
func (*Terminator) Add ¶
func (t *Terminator) Add(delta int)
Add adds delta to the count of goroutines in the group
func (*Terminator) Done ¶
func (t *Terminator) Done()
Done decrements the count of goroutines in the group by one
func (*Terminator) Go ¶ added in v1.1.0
func (t *Terminator) Go(f func())
Go runs a function inside an Add(1) --- Done() sequence
func (*Terminator) ShutDown ¶
func (t *Terminator) ShutDown() <-chan struct{}
ShutDown allows code to wait for a shut down signal
func (*Terminator) ShuttingDown ¶
func (t *Terminator) ShuttingDown() bool
ShuttingDown returns true if shutdown is in Default().progress
func (*Terminator) Stop ¶
func (t *Terminator) Stop()
Stop signals that all goroutines in the group should safely exit
func (*Terminator) Wait ¶
func (t *Terminator) Wait()
Wait blocks until every goroutines in the group has called Done()