aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pre-exit-hooks.lisp
blob: 42e41953fc1d93cb81c963a46aab2342aec94f61 (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)))