On 23 May 2010 11:09, Shaneal Manek <smanek@...> wrote:
> Is it possible to have SBCL execute its exit hooks (per
> and quit upon receiving a particular signal (e.g., SIGKILL, SIGABRT,
> or SIGUSR1)? Some experimenting suggests sending SBCL any of the
> standard 'shutdown' signals bypasses the exit hooks.
SIGKILL definitely not. It always immediately kills the process.
SIGABRT is a bit tricky. Currently it's intercepted by a C handler
which just kills the process, but it should be possible to let it into
Lisp -- which is what running *EXIT-HOOKS* means. Doing this requires
SIGUSR1 is easy.
(defun sigusr1-handler (signal code context)
(declare (ignore signal code context))
(sb-sys:enable-interrupt sb-posix:sigusr1 #'sigusr1-handler)