labels in cclock

This commit is contained in:
Simon Cruanes 2015-09-21 18:23:38 +02:00
parent 3c233d9cf3
commit dc896e3bbb
2 changed files with 3 additions and 3 deletions

View file

@ -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 ();

View file

@ -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