Merge pull request #94 from mseri/patch-1

Fix `CCSemaphore.with_acquire`: release a non locked mutex is UB (thanks to @mseri)
This commit is contained in:
Simon Cruanes 2017-01-24 23:59:51 +01:00 committed by GitHub
commit c359b3d570

View file

@ -53,14 +53,13 @@ let release m t =
*)
let with_acquire ~n t ~f =
Mutex.lock t.mutex;
acquire_once_locked_ n t;
acquire n t;
try
let x = f() in
release_once_locked_ n t;
release n t;
x
with e ->
release_once_locked_ n t;
release n t;
raise e
(*$R