Module Signal.Expert

module Expert: sig .. end
The Expert module contains functions that novice users should avoid, due to their complexity.

An OCaml signal handler can run at any time, which introduces all the semantic complexities of multithreading. It is much easier to use async signal handling, see Async_unix.Signal, which does not involve multithreading, and runs user code as ordinary async jobs. Also, beware that there can only be a single OCaml signal handler for any signal, so handling a signal with a Core signal handler will interfere if async is attempting to handle the same signal.

If you do use Core signal handlers, you should strive to make the signal handler perform a simple idempotent action, like setting a ref.


type behavior = [ `Default | `Handle of Signal.t -> unit | `Ignore ] 
val signal : Signal.t -> behavior -> behavior
signal t sets the behavior of the system on receipt of signal t and returns the behavior previously associated with t. If t is not available on your system, signal raises.
val set : Signal.t -> behavior -> unit
set t b is ignore (signal t b)
val handle : Signal.t -> (Signal.t -> unit) -> unit
handle t f is set t (`Handle f).