Imports #
"internal/runtime/atomic"
_ "unsafe"
"internal/runtime/atomic"
_ "unsafe"
var Goid func() uint64
runtime sets these for us
var Gosched func()
var Throw func(string)
var hooks []Hook
var locked atomic.Int32
var runGoid atomic.Uint64
var running bool
type exitError string
A Hook is a function to be run at program termination (when someone invokes os.Exit, or when main.main returns). Hooks are run in reverse order of registration: the first hook added is the last one run.
type Hook struct {
F func()
RunOnFailure bool
}
Add adds a new exit hook.
func Add(h Hook)
func (e exitError) Error() string
Run runs the exit hooks. If an exit hook panics, Run will throw with the panic on the stack. If an exit hook invokes exit in the same goroutine, the goroutine will throw. If an exit hook invokes exit in another goroutine, that exit will block.
func Run(code int)
Generated with Arrow