Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Supervisor ¶
type Supervisor struct {
// contains filtered or unexported fields
}
Supervisor owns background goroutines and awaits them on Shutdown.
func New ¶
func New(parent context.Context) *Supervisor
New creates a supervisor derived from parent.
func (*Supervisor) Closed ¶
func (s *Supervisor) Closed() bool
Closed reports whether Shutdown has been called.
func (*Supervisor) Context ¶
func (s *Supervisor) Context() context.Context
Context returns the supervisor context (canceled on Shutdown).
func (*Supervisor) Go ¶
func (s *Supervisor) Go(fn func(ctx context.Context))
Go starts a goroutine tracked by the supervisor. fn should exit promptly when ctx is canceled.
func (*Supervisor) GoNamed ¶
func (s *Supervisor) GoNamed(_ string, fn func(ctx context.Context))
GoNamed is like Go but panics are recovered (name for future diagnostics).
func (*Supervisor) Shutdown ¶
func (s *Supervisor) Shutdown()
Shutdown cancels the context and waits for all goroutines.
Click to show internal directories.
Click to hide internal directories.