signalx

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(signals []os.Signal, signal os.Signal) bool

func ContextWithSignal

func ContextWithSignal(ctx context.Context, signals ...os.Signal) (context.Context, context.CancelFunc)

ContextWithSignal creates a new context that cancels on the given signals.

func IsSignal

func IsSignal(err error, signals []os.Signal) bool

func IsSignalError

func IsSignalError(err error) bool

func ShutdownSignals

func ShutdownSignals() []os.Signal

func SignalContext

func SignalContext(signals ...os.Signal) (context.Context, context.CancelFunc)

SignalContext creates a new context that cancels on the given signals.

Types

type SignalError

type SignalError struct {
	Signal os.Signal
}

func (SignalError) Error

func (e SignalError) Error() string

type SignalHook

type SignalHook = map[os.Signal]func()

type SignalWaiter

type SignalWaiter struct {
	// contains filtered or unexported fields
}

func NewSignalWaiter

func NewSignalWaiter(signals []os.Signal, waitTimeout time.Duration, hooks ...func(os.Signal)) *SignalWaiter

func (*SignalWaiter) Err

func (w *SignalWaiter) Err() error

func (*SignalWaiter) Signal

func (w *SignalWaiter) Signal() os.Signal

func (*SignalWaiter) Wait added in v1.1.0

func (w *SignalWaiter) Wait() *SignalWaiter

Jump to

Keyboard shortcuts

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