mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-09 04:17:56 -04:00
fix: opentelemetry-client-ocurl: don't block signals on Windows
As of OCaml 5.3, the OCaml runtime doesn't support signals on
Windows. Trying to block them with Thread.sigmask will raise:
Thread 5 killed on uncaught exception Invalid_argument("Thread.sigmask not implemented")
Raised by primitive operation at Opentelemetry_client_ocurl.start_bg_thread.run in file "src/client-ocurl/opentelemetry_client_ocurl.ml", line 106, characters 12-49
This commit is contained in:
parent
1f4bdfa1f5
commit
b2e62d527e
1 changed files with 3 additions and 1 deletions
|
|
@ -87,7 +87,7 @@ 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 unix_run () =
|
||||||
let signals =
|
let signals =
|
||||||
[
|
[
|
||||||
Sys.sigusr1;
|
Sys.sigusr1;
|
||||||
|
|
@ -101,6 +101,8 @@ let start_bg_thread (f : unit -> unit) : Thread.t =
|
||||||
ignore (Thread.sigmask Unix.SIG_BLOCK signals : _ list);
|
ignore (Thread.sigmask Unix.SIG_BLOCK signals : _ list);
|
||||||
f ()
|
f ()
|
||||||
in
|
in
|
||||||
|
(* no signals on Windows *)
|
||||||
|
let run () = if Sys.win32 then f () else unix_run () in
|
||||||
Thread.create run ()
|
Thread.create run ()
|
||||||
|
|
||||||
let str_to_hex (s : string) : string =
|
let str_to_hex (s : string) : string =
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue