mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-09 12:23:32 -04:00
11 lines
241 B
OCaml
11 lines
241 B
OCaml
let lock_ : (unit -> unit) ref = ref ignore
|
|
|
|
let unlock_ : (unit -> unit) ref = ref ignore
|
|
|
|
let set_mutex ~lock ~unlock : unit =
|
|
lock_ := lock;
|
|
unlock_ := unlock
|
|
|
|
let[@inline] with_lock f =
|
|
!lock_ ();
|
|
Fun.protect ~finally:!unlock_ f
|