[MLton] interrupted system call

Matthew Fluet fluet@cs.cornell.edu
Fri, 26 Mar 2004 09:33:34 -0500 (EST)


> > > Because if you block all signals, you're beholden to unblock all signals
> > > when the ML signal handler gets a chance to run.
> >
> > No.  You can save the mask and then restore it.
> >
> >  let
> >     val m = Signal.Mask.getBlocked ()     (* not there yet *)
> >     val () = Signal.Mask.block Signal.mask.all
> >  in
> >     dynamicWind (fn () => call raiseSys,
> >                  fn () => Signal.Mask.setBlocked m)
> >  end

One more revision -- we shouldn't block signals that aren't being handled
by the ML signal handler.  For example, if the programmer installs a
signal handler for SIGALRM but not for SIGNINT, then I still want C-C to
kill the process.