Module Future

module Future: sig .. end
Computations run in background.

type 'a t 
The type of futures, that are computations run in background.
val cancel : 'a t -> bool -> bool
cancel f i attemps to cancel future f, i indicating whether to interrupt the computation if already started. Returns whether the future was cancelled.
val get : 'a t -> 'a
Waits for the computation to complete, and returns its result.

Raises Runtime.Interrupted if the thread is interrupted.

Raises Runtime.Raised is the computation raised an uncaught exception.

Raises Not_found if the computation was cancelled.

val get_time : 'a t -> int64 -> TimeUnit.t -> 'a
get_time f t u is similar to get f, except that the current thread will at most wait for t (time value whose unit is u).

Raises Runtime.Interrupted if the thread is interrupted.

Raises Runtime.Raised is the computation raised an uncaught exception.

Raises Not_found if the computation was cancelled.

Raises Runtime.Timeout if time has elapsed without completion.

val is_cancelled : 'a t -> bool
Tests whether the task was cancelled before completion.
val is_done : 'a t -> bool
Tests whether the computation is completed.