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 = let with_acquire ~n t ~f =
Mutex.lock t.mutex; acquire n t;
acquire_once_locked_ n t;
try try
let x = f() in let x = f() in
release_once_locked_ n t; release n t;
x x
with e -> with e ->
release_once_locked_ n t; release n t;
raise e raise e
(*$R (*$R