set-signal-handler
with a function handler configures LispWorks such that handler is called when the POSIX signal signum occurs.
If handler is nil
, any handler for signum is removed.
handler should be defined to take an &rest
argument, and ignore it. There are no restrictions on handler other than those applying to any asynchronous function call, and that it may be called in any thread. In particular there is no need to handle the signal immediately.
The configuration established by set-signal-handler
is not persistent over image saving (or application delivery), so it should be called each time the image (or application) is started.
The currently defined signal handlers are shown in the output of the bug report template which can generated via the :bug-form
listener command. For example, there is a SIGINT
handler which calls break
. You should consult Lisp Support before overwriting existing signal handlers.
LispWorks initially has no SIGHUP
handler. SIGHUP
will kill a LispWorks process which does not have a SIGHUP
handler installed. When the LispWorks IDE starts up, a SIGHUP
handler (which attempts to release locks in the environment) is installed. However if you need a SIGHUP
handler in a server application, for example, you should install one using set-signal-handler
.
(defun my-hup-handler (&rest x)
(declare (ignorable x))
(cerror "Continue"
"Got a HUP signal"))
(sys:set-signal-handler 1 'my-hup-handler)
Note that the LispWorks IDE overwrites a SIGHUP
handler, so you would need to reinstall it after GUI startup.
LispWorks User Guide and Reference Manual - 20 Sep 2017