File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,21 @@ let with_signal ?(signal = Sys.sigint) ~on_sig f =
79
79
let block_sigpipe_sigint () =
80
80
ignore (Thread. sigmask Unix. SIG_BLOCK [ Sys. sigint; Sys. sigpipe ] : _ list )
81
81
82
+ let block_signals () =
83
+ ignore
84
+ (Unix. sigprocmask Unix. SIG_BLOCK
85
+ [
86
+ Sys. sigterm;
87
+ Sys. sigpipe;
88
+ Sys. sigint;
89
+ Sys. sigchld;
90
+ Sys. sigalrm;
91
+ Sys. sigusr1;
92
+ Sys. sigusr2;
93
+ Sys. sigvtalrm;
94
+ ]
95
+ : _ list )
96
+
82
97
let read_i32_framed ic : string =
83
98
let buf_len = Bytes. create 4 in
84
99
really_input ic buf_len 0 4 ;
Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ val with_signal : ?signal:int -> on_sig:(int -> unit) -> (unit -> 'a) -> 'a
41
41
val block_sigpipe_sigint : unit -> unit
42
42
(* * Block these signals in this thread *)
43
43
44
+ val block_signals : unit -> unit
45
+ (* * Block a reasonable collection of signals in this thread *)
46
+
44
47
val read_i32_framed : in_channel -> string
45
48
(* * [read_i32_framed ic] reads a int32_le-framed message from [ic] *)
46
49
You can’t perform that action at this time.
0 commit comments