[Openmcl-devel] Changing behavior of terminal interrupt.

Gary Byers gb at clozure.com
Sun Nov 14 11:19:35 PST 2010


If you just want that interrupt to abruptly terminate the process (without
closing files or otherwise cleaning up after itself), you can get that behavior
by saying:

? (#_signal #$SIGINT #$SIG_DFL) ; restore handling of SIGINT to default

with the caveat that the constant SIG_DFL may or may not be defined.  (Whether
it's defined on a particular platform depends on how it's defined in that
platform's header files and on whether the interface translator could make
sense out of that definition.)

AFAIK, SIG_DFL is always defined as a null pointer (though it may be
"a null pointer to a function that takes an int and returns void"), so
it should always work to say:

? (#_signal #$SIGINT +null-ptr+)

Restoring the previous handler is left as an exercise.

If you're using a relatively recent CCL, you could also use WAIT-FOR-SIGNAL,
which is documented in section 4.14 of the manual.

(defun quit-on-terminal-interrupt ()
   (wait-for-signal #$SIGINT nil) ; wait forever
   (quit))                        ; try for orderly exit

(process-run-function "wait-for-sigint" #'quit-on-terminal-interrupt)





On Sun, 14 Nov 2010, Kaz Kylheku wrote:

>
> Hi all,
>
> What's the recommened way to have the terminal interrupt just terminate the 
> process?
>
> Is there any way to turn that into a condition that can be handled (whereby 
> the handler could do the termination or whatever else?)
>
> Thanks.
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list