Documentation ¶
Index ¶
Constants ¶
const (
ErrMsg = "stoppable %q is not running, exiting %s early " + errKey
)
Error message returned after a comms operations ends and finds that its parent thread is stopping or stopped.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Multi ¶
type Multi struct {
// contains filtered or unexported fields
}
func (*Multi) Close ¶
Close issues a close signal to all child stoppables and marks the status of the Multi Stoppable as stopping. Returns an error if one or more child stoppables failed to close, but it does not return their specific errors and assumes they print them to the log.
func (*Multi) GetRunningProcesses ¶
GetRunningProcesses returns the names of all running processes at the time of this call. Note that this list may change and is subject to race conditions if multiple threads are in the process of starting or stopping.
func (*Multi) GetStatus ¶
GetStatus returns the lowest status of all of the Stoppable children. The status is not the status of all Stoppables, but the status of the Stoppable with the lowest status.
func (*Multi) IsStopping ¶
IsStopping returns true if Stoppable is marked as stopping.
type Single ¶
type Single struct {
// contains filtered or unexported fields
}
Single allows stopping a single goroutine using a channel. It adheres to the Stoppable interface.
func (*Single) Close ¶
Close signals the Single to close via the quit channel. Returns an error if the status of the Single is not Running.
func (*Single) IsStopping ¶
IsStopping returns true if Stoppable is marked as stopping.
type Stoppable ¶
type Stoppable interface { // Name returns the name of the Stoppable. Name() string // GetStatus returns the status of the Stoppable. GetStatus() Status // IsRunning returns true if the Stoppable is running. IsRunning() bool // IsStopping returns true if Stoppable is marked as stopping. IsStopping() bool // IsStopped returns true if Stoppable is marked as stopped. IsStopped() bool // Close marks the Stoppable as stopping and issues a close signal to the // Stoppable or any children it may have. Close() error }
Stoppable interface for stopping a goroutine. All functions are thread safe.