signal

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(sig os.Signal, handler Handler)

Register a signal handler to the registry

func Serve

func Serve()

Serve the signal notifier

Should be run as: go signal.Serve()

Currently support signals: SIGHUP, SIGINT, SIGQUIT, SIGABRT, SIGALRM, SIGTERM, SIGUSR1, SIGUSR2.

The Handler function should returns a bool value, which means if the function accept the termination.
If all got by the handler function returns "true" and the signal is one of SIGINT, SIGQUIT, SIGTERM,
the program would exit with code 0.

Types

type Handler

type Handler struct {
	Name string
	Func func(sig os.Signal) bool
}

Handler defines a signal handler struct

Jump to

Keyboard shortcuts

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