aboutsummaryrefslogtreecommitdiff
path: root/lib/future.ml
diff options
context:
space:
mode:
authorEnrico Tassi2020-06-12 10:54:06 +0200
committerEnrico Tassi2020-06-12 10:54:06 +0200
commit13e8d04b2f080fbc7ca169bc39e53c8dd091d279 (patch)
tree4a430fe3e8d1b7f0e21e6296e3739399c5db9744 /lib/future.ml
parent96d206a9b249f28d489a453eb6a6ed627a5aa49b (diff)
parent213c9284ad5164f39df90da757ebfed44179f851 (diff)
Merge PR #12357: [declare] Remove some unused `fix_exn`
Reviewed-by: gares
Diffstat (limited to 'lib/future.ml')
-rw-r--r--lib/future.ml14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/future.ml b/lib/future.ml
index 661637fcd1..23d089fb6b 100644
--- a/lib/future.ml
+++ b/lib/future.ml
@@ -67,8 +67,8 @@ and 'a computation = 'a comput ref
let unnamed = "unnamed"
-let create ?(name=unnamed) ?(uuid=UUID.fresh ()) f x =
- ref (Ongoing (name, CEphemeron.create (uuid, f, ref x)))
+let create ?(name=unnamed) ?(uuid=UUID.fresh ()) ~fix_exn x =
+ ref (Ongoing (name, CEphemeron.create (uuid, fix_exn, ref x)))
let get x =
match !x with
| Finished v -> unnamed, UUID.invalid, id, ref (Val v)
@@ -97,9 +97,7 @@ let peek_val kx = let _, _, _, x = get kx in match !x with
let uuid kx = let _, id, _, _ = get kx in id
-let from_val ?(fix_exn=id) v = create fix_exn (Val v)
-
-let fix_exn_of ck = let _, _, fix_exn, _ = get ck in fix_exn
+let from_val v = create ~fix_exn:id (Val v)
let create_delegate ?(blocking=true) ~name fix_exn =
let assignment signal ck = fun v ->
@@ -116,7 +114,7 @@ let create_delegate ?(blocking=true) ~name fix_exn =
let cond = Condition.create () in
(fun () -> Mutex.lock lock; Condition.wait cond lock; Mutex.unlock lock),
(fun () -> Mutex.lock lock; Condition.broadcast cond; Mutex.unlock lock) in
- let ck = create ~name fix_exn (Delegated wait) in
+ let ck = create ~name ~fix_exn (Delegated wait) in
ck, assignment signal ck
(* TODO: get rid of try/catch to be stackless *)
@@ -143,12 +141,12 @@ let force x = match compute x with
let chain ck f =
let name, uuid, fix_exn, c = get ck in
- create ~uuid ~name fix_exn (match !c with
+ create ~uuid ~name ~fix_exn (match !c with
| Closure _ | Delegated _ -> Closure (fun () -> f (force ck))
| Exn _ as x -> x
| Val v -> Val (f v))
-let create fix_exn f = create fix_exn (Closure f)
+let create ~fix_exn f = create ~fix_exn (Closure f)
let replace kx y =
let _, _, _, x = get kx in