mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-08 03:47:59 -04:00
use named signals
This commit is contained in:
parent
83b9837778
commit
9ba1719795
1 changed files with 11 additions and 2 deletions
|
|
@ -66,8 +66,17 @@ end
|
||||||
(** start a thread in the background, running [f()] *)
|
(** start a thread in the background, running [f()] *)
|
||||||
let start_bg_thread (f : unit -> unit) : Thread.t =
|
let start_bg_thread (f : unit -> unit) : Thread.t =
|
||||||
let run () =
|
let run () =
|
||||||
(* block some signals: USR1 USR2 TERM PIPE ALARM STOP, see [$ kill -L] *)
|
let signals =
|
||||||
ignore (Thread.sigmask Unix.SIG_BLOCK [ 10; 12; 13; 14; 15; 19 ] : _ list);
|
[
|
||||||
|
Sys.sigusr1;
|
||||||
|
Sys.sigusr2;
|
||||||
|
Sys.sigterm;
|
||||||
|
Sys.sigpipe;
|
||||||
|
Sys.sigalrm;
|
||||||
|
Sys.sigstop;
|
||||||
|
]
|
||||||
|
in
|
||||||
|
ignore (Thread.sigmask Unix.SIG_BLOCK signals : _ list);
|
||||||
f ()
|
f ()
|
||||||
in
|
in
|
||||||
Thread.create run ()
|
Thread.create run ()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue