Documentation
¶
Overview ¶
Package stop implements a pattern for shutting down a group of processes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AlreadyStoppedFunc = func() Result { return AlreadyStopped }
AlreadyStoppedFunc is a Func that returns AlreadyStopped.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel chan []error
Channel is used to return zero or more errors asynchronously. Call Done() once to pass errors to the Channel.
type Func ¶
type Func func() Result
Func is a function that can be used to provide a clean shutdown.
type Group ¶
Group is a collection of Stoppers that can be stopped all at once.
type Result ¶
type Result <-chan []error
Result is a receive-only version of Channel. Call Wait() once to receive any returned errors.
var AlreadyStopped Result
AlreadyStopped is a closed error channel to be used by Funcs when an element was already stopped.
type Stopper ¶
type Stopper interface { // Stop returns a channel that indicates whether the stop was // successful. // // The channel can either return one error or be closed. // Closing the channel signals a clean shutdown. // Stop() should return immediately and perform the actual shutdown in a // separate goroutine. Stop() Result }
Stopper is an interface that allows a clean shutdown.
Click to show internal directories.
Click to hide internal directories.