Documentation
¶
Index ¶
- func IsTerminating(ctx context.Context) bool
- func IsTerminationContext(ctx context.Context) bool
- func Shutdown(ctx context.Context, callback ShutdownCallback)
- func Terminate(ctx context.Context, err error, exitCode int)
- func WithTermination(ctx context.Context) context.Context
- type ShutdownCallback
- type TerminationDescriptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTerminating ¶
IsTerminating returns true if termination is in progress. ctx must be the context created WithTermination(). It is safe for concurrent usage.
func IsTerminationContext ¶
IsTerminationContext returns "true" if ctx is termination one. It is safe for concurrent usage.
func Shutdown ¶
func Shutdown(ctx context.Context, callback ShutdownCallback)
Shutdown handles termination using terminationCtx. ctx must be the context created WithTermination(). Callback is always called.
Types ¶
type ShutdownCallback ¶
type ShutdownCallback func(ctx context.Context, desc TerminationDescriptor)
type TerminationDescriptor ¶
type TerminationDescriptor struct {
// contains filtered or unexported fields
}
func (TerminationDescriptor) Err ¶
func (t TerminationDescriptor) Err() error
func (TerminationDescriptor) ExitCode ¶
func (t TerminationDescriptor) ExitCode() int
func (TerminationDescriptor) Signal ¶
func (t TerminationDescriptor) Signal() os.Signal
Click to show internal directories.
Click to hide internal directories.