interrupt

package
v0.0.0-...-a838072 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: Unlicense, ISC Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// InterruptChan is used to receive SIGINT (Ctrl+C) signals.
	InterruptChan chan os.Signal
	// InterruptSignals is the list of signals that cause the interrupt
	InterruptSignals = []os.Signal{os.Interrupt, syscall.SIGTERM}
	// ShutdownRequestChan is a channel that can receive shutdown requests
	ShutdownRequestChan = make(chan struct{})
	// AddHandlerChannel is used to add an interrupt handler to the list of handlers to be invoked on SIGINT (Ctrl+C) signals.
	AddHandlerChannel = make(chan func())
	// HandlersDone is closed after all interrupt handlers run the first time an interrupt is signaled.
	HandlersDone = make(chan struct{})
)

nolint

View Source
var Log = cl.NewSubSystem(pkgs.Name(_d), "info")

Functions

func AddHandler

func AddHandler(handler func())

AddHandler adds a handler to call when a SIGINT (Ctrl+C) is received.

func Listener

func Listener()

Listener listens for interrupt signals, registers interrupt callbacks, and responds to custom shutdown signals as required

func Request

func Request()

Request programatically requests a shutdown

func Requested

func Requested() bool

Requested returns true if an interrupt has been requested

func UseLogger

func UseLogger(logger *cl.SubSystem,
)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using log.

Types

This section is empty.

Source Files

  • interrupt.go
  • log.go
  • signalsigterm.go

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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