diff options
author | Thomas Voss <mail@thomasvoss.com> | 2025-06-14 00:45:04 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2025-06-14 00:45:04 +0200 |
commit | fe2bae01c6b14eef0e61cd4a6bd50e814de4bb58 (patch) | |
tree | 60fbda65d5fa3a9afc966bce51b6968e966baf4c /pkg/atexit/atexit.go | |
parent | 2d5ca3a6cd507ef29eb13b3a78232264a2817e81 (diff) |
Move some packages to pkg/
Diffstat (limited to 'pkg/atexit/atexit.go')
-rw-r--r-- | pkg/atexit/atexit.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/atexit/atexit.go b/pkg/atexit/atexit.go new file mode 100644 index 0000000..ed35ccf --- /dev/null +++ b/pkg/atexit/atexit.go @@ -0,0 +1,13 @@ +package atexit + +var hooks = []func(){} + +func Register(f func()) { + hooks = append(hooks, f) +} + +func Exec() { + for i := len(hooks)-1; i >= 0; i-- { + hooks[i]() + } +} |