signal

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After(duration time.Duration) <-chan struct{}

After returns a read only channel that closes after the given duration

func Combine

func Combine(signals ...<-chan struct{}) <-chan struct{}

Combine return a read only channel that closes after receiving anything from one of the given channels

func Context

func Context(signal <-chan struct{}) context.Context

Context returns a context that is cancelled upon the given signal

func RequestShutdown

func RequestShutdown() bool

RequestShutdown emulates a received event that is considered as shutdown signal (SIGTERM/SIGINT) This returns whether a collector was notified

func SetupStopSignalContext

func SetupStopSignalContext() (*errgroup.Group, <-chan struct{})

SetupStopSignalContext works similarly to SetupStopSignalHandler. It returns two objects. One is an errgroup.Group object (refer to https://godoc.org/golang.org/x/sync/errgroup to see how errgroup.Group works); aother is a channel that is closed when either a SIGTERM or a SIGINT signal is received or when one of the task that was executed by the Group is done.

func SetupStopSignalHandler

func SetupStopSignalHandler() <-chan struct{}

SetupStopSignalHandler registered for SIGTERM and SIGINT. A stop channel is returned which is closed on one of these signals. If a second signal is caught, the program is terminated with exit code 1. copied from https://github.com/kubernetes/apiserver/blob/master/pkg/server/signal.go

Types

This section is empty.

Jump to

Keyboard shortcuts

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