mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
single system call for signal blocking
This commit is contained in:
parent
dd88008a0a
commit
f0ea8c294d
1 changed files with 16 additions and 13 deletions
|
|
@ -103,9 +103,10 @@ let with_handler ~ops:_ self f = f ()
|
||||||
[@@@endif]
|
[@@@endif]
|
||||||
|
|
||||||
let worker_loop (type st) ~block_signals ~(ops : st ops) (self : st) : unit =
|
let worker_loop (type st) ~block_signals ~(ops : st ops) (self : st) : unit =
|
||||||
if block_signals then
|
if block_signals then (
|
||||||
List.iter
|
try
|
||||||
(fun signal -> try Sys.set_signal signal Sys.Signal_ignore with _ -> ())
|
ignore
|
||||||
|
(Unix.sigprocmask SIG_BLOCK
|
||||||
[
|
[
|
||||||
Sys.sigterm;
|
Sys.sigterm;
|
||||||
Sys.sigpipe;
|
Sys.sigpipe;
|
||||||
|
|
@ -114,8 +115,10 @@ let worker_loop (type st) ~block_signals ~(ops : st ops) (self : st) : unit =
|
||||||
Sys.sigalrm;
|
Sys.sigalrm;
|
||||||
Sys.sigusr1;
|
Sys.sigusr1;
|
||||||
Sys.sigusr2;
|
Sys.sigusr2;
|
||||||
Sys.sigvtalrm;
|
]
|
||||||
];
|
: _ list)
|
||||||
|
with _ -> ()
|
||||||
|
);
|
||||||
|
|
||||||
let cur_fiber : fiber ref = ref _dummy_fiber in
|
let cur_fiber : fiber ref = ref _dummy_fiber in
|
||||||
let runner = ops.runner self in
|
let runner = ops.runner self in
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue