[Openmcl-devel] Unix signal handling

Gary Byers gb at clozure.com
Wed Jul 7 06:03:06 UTC 2010

On Tue, 6 Jul 2010, Scott L. Burson wrote:

> On Tue, Jul 6, 2010 at 9:18 PM, Gary Byers <gb at clozure.com> wrote:
>> CCL's own signal/exception handlers go through a fairly strict protocol to
>> try to ensure GC safety, and anything we do to support user-defined signal
>> handlers would have to deal with similar issues in similar ways.
> Okay, fair enough, but is there a possible synthesis here?  What if we
> had a vector of semaphores, and a generic signal handler in C whose
> only action was to signal the corresponding semaphore?  The Lisp-level
> handler then runs in a separate thread that waits on the semaphore and
> then calls the handler.  The handler can interrupt some other thread
> or do whatever else it wants.
> -- Scott

Sure; my only real dog in the fight is to slap people around a little
if it looks like they're thinking about doing something that's not
GC-safe.  (It's a tireless, thankless job, but someone has to do it.)

I like your "vector of semaphores" idea; in a lot of cases (like the
one that you describe), it's adequate to know that a signal's been
received by (some thread in) the application "soon" after the fact,
and the semaphore would be signaled (and a thread waiting on it would
wake up) very soon after the signal was received.

More information about the Openmcl-devel mailing list