let
critical_section l ~f =
lock l;
Exn
.protect ~f ~finally:(
fun
()
->
unlock l)