aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/future.mli
diff options
context:
space:
mode:
authorGravatar Enrico Tassi <Enrico.Tassi@inria.fr>2014-02-19 10:45:49 +0100
committerGravatar Enrico Tassi <Enrico.Tassi@inria.fr>2014-02-26 14:53:08 +0100
commit7726a81d850020b6402f445912f3a3d9310da69d (patch)
tree93f8219fd02efc9eeee6ea704c551de593d620eb /lib/future.mli
parente4c81a456ed7279e255e0df2a73e14c77946be7e (diff)
Future: each computation has a uuid
Diffstat (limited to 'lib/future.mli')
-rw-r--r--lib/future.mli14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/future.mli b/lib/future.mli
index 4dca2f144..13f8ee961 100644
--- a/lib/future.mli
+++ b/lib/future.mli
@@ -50,6 +50,16 @@
* they will become invalid and accessing them raises a private exception.
*)
+(* Each computation has a unique id that is inherited by each offspring
+ * computation (chain, split, map...). Joined computations lose it. *)
+module UUID : sig
+ type t
+ val invalid : t
+
+ val compare : t -> t -> int
+ val equal : t -> t -> bool
+end
+
exception NotReady
type 'a computation
@@ -75,7 +85,8 @@ val from_val : ?fix_exn:fix_exn -> 'a -> 'a computation
val from_here : ?fix_exn:fix_exn -> 'a -> 'a computation
(* Run remotely, returns the function to assign. Optionally tekes a function
- that is called when forced. The default one is to raise NotReady *)
+ that is called when forced. The default one is to raise NotReady.
+ The assignement function does not change the uuid. *)
type 'a assignement = [ `Val of 'a | `Exn of exn | `Comp of 'a computation]
val create_delegate :
?force:(unit -> 'a assignement) ->
@@ -89,6 +100,7 @@ val is_over : 'a computation -> bool
val is_val : 'a computation -> bool
val is_exn : 'a computation -> bool
val peek_val : 'a computation -> 'a option
+val uuid : 'a computation -> UUID.t
(* [chain greedy pure c f] chains computation [c] with [f].
* The [greedy] and [pure] parameters are tricky: