Module Async_unix.Signal

Signal handling.

To discourage use of the Signal.Expert module, we hide it here. People can use Core.Signal.Expert if they need.

include module type of Core.Signal with type Signal.t = Core.Signal.t with module Signal.Expert := Core.Signal.Expert
type t = Core.Signal.t
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
val bin_shape_t : Bin_prot.Shape.t
val bin_writer_t : t Bin_prot.Type_class.writer
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_t : t Bin_prot.Type_class.t
val t_of_sexp : Sexplib0.Sexp.t -> t
val sexp_of_t : t -> Sexplib0.Sexp.t
val (>=) : t -> t -> bool
val (<=) : t -> t -> bool
val (=) : t -> t -> bool
val (>) : t -> t -> bool
val (<) : t -> t -> bool
val (<>) : t -> t -> bool
val min : t -> t -> t
val max : t -> t -> t
val ascending : t -> t -> int
val descending : t -> t -> int
val between : t -> low:t -> high:t -> bool
val clamp_exn : t -> min:t -> max:t -> t
val clamp : t -> min:t -> max:t -> t Base.Or_error.t
type comparator_witness = Core__Signal.comparator_witness
val comparator : (tcomparator_witness) Base.Comparator.comparator
val validate_lbound : min:t Base.Maybe_bound.t -> t Base.Validate.check
val validate_ubound : max:t Base.Maybe_bound.t -> t Base.Validate.check
val validate_bound : min:t Base.Maybe_bound.t -> max:t Base.Maybe_bound.t -> t Base.Validate.check
module Replace_polymorphic_compare : sig ... end
module Map : sig ... end
module Set : sig ... end
val compare : t -> t -> Core_kernel__.Import.int
val hash_fold_t : Base.Hash.state -> t -> Base.Hash.state
val hash : t -> Base.Hash.hash_value
val hashable : t Core_kernel.Hashtbl.Hashable.t
module Table : sig ... end
module Hash_set : sig ... end
module Hash_queue : sig ... end
val of_string : string -> t
val equal : t -> t -> bool
val of_system_int : int -> t
val to_system_int : t -> int
val of_caml_int : int -> t
val to_caml_int : t -> int
val to_string : t -> string
type sys_behavior = [
| `Continue
| `Dump_core
| `Ignore
| `Stop
| `Terminate
]
val sexp_of_sys_behavior : sys_behavior -> Ppx_sexp_conv_lib.Sexp.t
val sys_behavior_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> sys_behavior
val __sys_behavior_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> sys_behavior
val default_sys_behavior : t -> sys_behavior
val handle_default : t -> unit
val ignore : t -> unit
type pid_spec = [
| `Group of Core__.Import.Pid.t
| `My_group
| `Pid of Core__.Import.Pid.t
]
val sexp_of_pid_spec : pid_spec -> Ppx_sexp_conv_lib.Sexp.t
val send : t -> pid_spec -> [ `No_such_process | `Ok ]
val send_i : t -> pid_spec -> unit
val send_exn : t -> pid_spec -> unit
val can_send_to : Core__.Import.Pid.t -> bool
type sigprocmask_command = [
| `Block
| `Set
| `Unblock
]
val sigprocmask : sigprocmask_command -> t list -> t list
val sigpending : unit -> t list
val sigsuspend : t list -> unit
val abrt : t
val alrm : t
val bus : t
val chld : t
val cont : t
val fpe : t
val hup : t
val ill : t
val int : t
val kill : t
val pipe : t
val poll : t
val prof : t
val quit : t
val segv : t
val sys : t
val stop : t
val term : t
val trap : t
val tstp : t
val ttin : t
val ttou : t
val urg : t
val usr1 : t
val usr2 : t
val vtalrm : t
val xcpu : t
val xfsz : t
val zero : t
module Stable : sig ... end
val handle_default : [ `Do_not_use_with_async ] -> _

We override values from Core.Signal that we don't want people to use with Async.

val ignore : [ `Do_not_use_with_async ] -> _
val handle : ?⁠stop:unit Async_unix__.Import.Deferred.t -> t list -> f:(t -> unit) -> unit

handle ?stop signals ~f arranges so that whenever a signal in signals is delivered, f is called on that signal. If f raises, then an exception will be raised to the monitor in effect when handle was called.

Multiple calls to handle with the same signal will cause all the handlers to run when that signal is delivered, not just the last handler from the last call to handle.

The first time handle is called for a signal, it will install a C signal handler for it, replacing the existing C signal handler for that signal.

val terminating : t list

terminating is a list of signals that can be supplied to handle and whose default behavior is to terminate the program: alrm hup int term usr1 usr2.

Various signals whose default_sys_behavior is `Terminate are not included:

       | kill   | it's not allowed to be handled                            |
       | pipe   | Async already ignores this signal, since it handles EPIPE |
       | prof   | so that we can profile things with -p                     |
       | vtalrm | it already has a handler                                  |
val is_managed_by_async : t -> bool

is_managed_by_async signal returns true iff signal is being managed by Async, and hence its default behavior is no longer in effect.