NextPrevUpTopContentsIndex

set-signal-handler

Function
Summary

Installs or removes a handler for a Unix signal.

Note: applicable only on UNIX/Linux/Mac OS X.

Package

system

Signature

set-signal-handler signum handler

Arguments

signum

A Unix signal number.

handler

A function or nil .

Description

set-signal-handler with a function handler configures LispWorks such that handler is called when the Unix 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 asychronous 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.

Note: 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 Xanalys Lisp Support before overwriting existing signal handlers.

Note: LispWorks initially has no SIGHUP handler. SIGHUP will kill a LispWorks process which does not have a SIGHUP handler installed. When the Common LispWorks GUI 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 .

Example
(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 Common LispWorks GUI overwrites a SIGHUP handler, so you would need to reinstall it after GUI startup.


LispWorks Reference Manual - 23 Jul 2004

NextPrevUpTopContentsIndex