Documentation ¶
Overview ¶
Package atexit provides handling for functions you want called when the program exits unexpectedly due to a signal.
You should also make sure you call Run in the normal exit path.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IgnoreSignals ¶
func IgnoreSignals()
IgnoreSignals disables the signal handler and prevents Run from being executed automatically
func OnError ¶
func OnError(perr *error, fn func()) func()
OnError registers fn with atexit and returns a function which runs fn() if *perr != nil and deregisters fn
It should be used in a defer statement normally so
defer OnError(&err, cancelFunc)()
So cancelFunc will be run if the function exits with an error or at exit.
func Unregister ¶
func Unregister(handle FnHandle)
Unregister a function using the handle returned by `Register`
Types ¶
Click to show internal directories.
Click to hide internal directories.