diff options
author | Colin Okay <colin@cicadas.surf> | 2022-07-27 08:49:15 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-07-27 08:49:15 -0500 |
commit | def70bc521a71b3bfa8d8b0bb982bbcd1743bd22 (patch) | |
tree | 0737d55c92934f6500c3e515a9a2b88ec9d326c8 /src/pre-exit-hooks.lisp | |
parent | 4ec779a31486fdedf038c35f975723b3abc04c8c (diff) |
[refactor] to get rid of finalizers. [add] pre-exit-hooks
Diffstat (limited to 'src/pre-exit-hooks.lisp')
-rw-r--r-- | src/pre-exit-hooks.lisp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/pre-exit-hooks.lisp b/src/pre-exit-hooks.lisp new file mode 100644 index 0000000..42e4195 --- /dev/null +++ b/src/pre-exit-hooks.lisp @@ -0,0 +1,16 @@ +;;; pre-exit-hooks.lisp + +(in-package :wheelwork) + +(defvar *pre-exit-hooks* (make-hash-table)) + +(defun pre-exit-hook-exists-p (tag) + (gethash tag *pre-exit-hooks*)) + +(defun pre-exit-hook (tag thunk) + (setf (gethash tag *pre-exit-hooks*) + thunk)) + +(defun pre-exit-hooks () + (loop for thunk being the hash-value of *pre-exit-hooks* + do (funcall thunk))) |