Discover Packages
github.com/apmckinlay/gsuneido
util
exit
package
Version:
v0.0.0-...-f022186
Opens a new window with list of versions in this module.
Published: May 29, 2024
License: MIT
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
func Add(desc string , fn func())
Add registers a function to be called on exit.
Exit calls RunFuncs and then os.Exit
It also starts a failsafe timer which will exit in 10 seconds regardless.
RunFuncs runs the Add'ed exit functions.
Only the first caller will run them, any other callers will block.
The functions are run in the reverse order that they were Add'ed.
Wait should only be called after Exit or RunFuncs. It blocks until exit.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.