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

Matthew Fluet fluet@cs.cornell.edu
Thu, 15 Apr 2004 08:53:38 -0400 (EDT)


> >   Keep gcState.signalsBlocked in sync with the user program.
> >   To do so, we keep an ML side representation of the currently blocked
> >   signals.
>
> I notice that the initial value of the blocked signals mask is
> Signal.Mask.none.  I wonder if it would be better to call sigprocmask
> to find out the current mask and use that instead?  This is what we do
> for initializing our ML-side representation of the signal handler
> array.

That would probably make sense.

> > Upon a MLton.Signal.Mask.{block,unblock,setBlocked}, we
> > compute the new set of blocked signals and call sigprocmask with
> > SIG_SETMASK.
>
> I wonder of it makes sense, given that there is more computation going
> on now, to represent masks with bool array (or even word array)
> instead of signal list.

The WordArray would give really fast block and unblock (of the current
blocked set), although you may end up doing more sigaddset calls than if
the mask were represented by AllBut.

> Also, would the name Sigset be better than Mask?
>
> I think a better name for Mask.member is Mask.isMember or even
> Mask.hasSignal (to be consistent with other parts of the MLton
> structure that use "are", "has", or "is" to indicate a predicate).

Certainly Sigset.isMember makes the connection with sigismember a bit more
obvious, so I would go with isMember.