utils

package
v0.2.4-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2020 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultTerminateSignals default signals to handle
	// if not signals are provided
	// NOTE: we use the default st here instead of ALL signals
	// to avoid dying on signals like SIGCHLD and others that
	// are not intend to terminate the process
	DefaultTerminateSignals = []os.Signal{
		syscall.SIGTERM, syscall.SIGHUP, syscall.SIGINT,
		syscall.SIGQUIT,
	}
)

Functions

func OnDone

func OnDone(ctx context.Context, cb func(error))

OnDone registers a callback on a context when it's done The ctx.Err() is passed as is to the callback function

func WithSignal

func WithSignal(ctx context.Context, sig ...os.Signal) (context.Context, context.CancelFunc)

WithSignal return a context that is canceld if any of the specified signals was received

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL