[MLton] cvs commit: better blocking/unblocking of signals in runtime

Stephen Weeks MLton@mlton.org
Sun, 28 Mar 2004 22:37:59 -0800


> The right thing to do would be in runtime/Posix/Signal.c:
> 
> Int Posix_Signal_sigprocmask (Int how) {
> 	if (gcState.inSignalHandler) {
> 		/* Change gcState.signalsBlocked appropriately,
> 		 * so that they are restored at GC_finishHandler.
> 		 * Don't change the actual signal mask.
> 		 */
> 		return 1;
> 	}
> 	return sigprocmask (how, &set, (sigset_t*)NULL);
> }

This makes sense.
 
> Unfortunately, Posix doesn't seem to give you a way of doing that.  I can
> do it with some GNU extensions:

How about doing it all from the SML side?  The idea is to always (not
just when in a handler) maintain s->signalsBlocked as the set of
signals blocked by SML.  It seems easy enough to modify the little bit
of code in basis-library/mlton/signal.sml that builds the sigset and
calls sigprocmask to update signalsBlocked as well.