interrupt

package
v0.0.24-0...-34ad285 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: ISC Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Restart bool // = true

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

Functions

func AddHandler

func AddHandler(handler func())

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

func Listener

func Listener()

Receiver 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 RequestRestart

func RequestRestart()

RequestRestart sets the reset flag and requests a restart

func Requested

func Requested() bool

Requested returns true if an interrupt has been requested

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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