next up previous contents
Next: MLton.Socket Up: MLton Previous: MLton.Rusage   Contents


MLton.Signal

Signals handlers are functions from threads to threads. When a signal handler is invoked, it receives as an argument the thread that was interrupted by the signal. The signal handler returns the thread that it would like to resume execution. It is an error for a signal handler to raise an exception. All signals are automatically blocked for the duration of a handler.

signature MLTON_SIGNAL =
   sig
      include POSIX_SIGNAL

      val prof: signal
      val vtalrm: signal

      structure Mask:
         sig
            type t
               
            val all: t
            val some: signal list -> t
            val block: t -> unit
            val unblock: t -> unit
            val set: t -> unit
         end

      structure Handler:
         sig
            datatype t =
               Default
             | Ignore
             | Handler of unit Thread.t -> unit Thread.t

            val get: signal -> t
            val set: signal * t -> unit
            val simple: (unit -> unit) -> t
         end
   end

prof

SIGPROF, the profiling signal.

vtalrm

SIGVTALRM, the signal for virtual timers.

Mask.t

the type of signal masks

Mask.all

a mask of all signals.

Mask.some l

a mask of the signals in l.

Mask.block m

block all signals in m.

Mask.unblock m

unblock all signals in m.

Mask.set m

set the signal mask to m.

Handler.get s

return the current handler for signal s.

Handler.set (s, h)

set the handler for signal s to be h.

Handler.simple f

return a handler that executes f () and then lets the interrupted thread continue.


next up previous contents
Next: MLton.Socket Up: MLton Previous: MLton.Rusage   Contents