diff options
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))) |