aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pre-exit-hooks.lisp
blob: 1f14d973c32881f6dfa9daa4bf0d9ebc19a60a7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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)))