diff --git a/src/threads/CCLock.ml b/src/threads/CCLock.ml index 915a8d25..3a635482 100644 --- a/src/threads/CCLock.ml +++ b/src/threads/CCLock.ml @@ -66,7 +66,7 @@ module LockRef = struct let update t f = t.content <- f t.content end -let with_lock_as_ref l f = +let with_lock_as_ref l ~f = Mutex.lock l.mutex; try let x = f l in @@ -80,7 +80,7 @@ let with_lock_as_ref l f = let l = create 0 in let test_it l = with_lock_as_ref l - (fun r -> + ~f:(fun r -> let x = LockRef.get r in LockRef.set r (x+10); Thread.yield (); diff --git a/src/threads/CCLock.mli b/src/threads/CCLock.mli index 50a40fd7..c541e8ac 100644 --- a/src/threads/CCLock.mli +++ b/src/threads/CCLock.mli @@ -52,7 +52,7 @@ module LockRef : sig val update : 'a t -> ('a -> 'a) -> unit end -val with_lock_as_ref : 'a t -> ('a LockRef.t -> 'b) -> 'b +val with_lock_as_ref : 'a t -> f:('a LockRef.t -> 'b) -> 'b (** [with_lock_as_ref l f] calls [f] with a reference-like object that allows to manipulate the value of [l] safely. The object passed to [f] must not escape the function call