Imports #
"internal/runtime/atomic"
_ "unsafe"
"internal/runtime/atomic"
_ "unsafe"
var Goid func() uint64runtime sets these for us
var Gosched func()var Throw func(string)var hooks []Hookvar locked atomic.Int32var runGoid atomic.Uint64var running booltype exitError stringA 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() stringRun 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