[Openmcl-devel] Signal handling

Gary Byers gb at clozure.com
Mon Apr 27 08:17:55 PDT 2009

CCL doesn't offer support for user-defined signal handlers because:

1) there can be lots of tricky issues involved in doing that in
    a thread-and-GC-safe way, over and above the usual issues
2) there are almost always simpler ways to do what needs to be done.

The first of these things is certainly true.  Whether or not the
second is also true depends on what needs to be done.

IF (a big if) there's really no other way to address some need than to
use a user-defined signal handler, then I suspect that it wouldn't be
adequate to just roll your own with the FFI.  Simple cases of that
could work, but the GC complicates things: if the signal is received
while the thread that handles it is running lisp code, you want it to
be able to return to the same (logical) point in that code on signal
return, which can be tricky if the GC runs and moves that code elsewhere.

So far, whenever the issue has come up, I've been able to scare anyone
who believes that they need the ability to define signal handlers out
of that belief.  Sooner or later, that may not be possible and it'll
be necessary to provide real support for this (that handles all of the
GC-related issues for you), but my first reaction here is to try to
scare you out of the idea.

On Mon, 27 Apr 2009, Leslie P. Polzer wrote:

> CCL doesn't seem to offer an interface for UNIX/POSIX signals,
> so I need to use the FFI. Is this correct?
>  Thanks!
>    Leslie
> -- 
> LinkedIn Profile: http://www.linkedin.com/in/polzer
> Xing Profile: https://www.xing.com/profile/LeslieP_Polzer
> Blog: http://blog.viridian-project.de/
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel

More information about the Openmcl-devel mailing list