package bap-future

  1. Overview
  2. Docs

An promise to provide a value in a future.

type 'a t = 'a promise
val fulfill : 'a t -> 'a -> unit

fulfill promise will fill a future value associated with a promise and evaluate to unit if promise is not yet fulfilled.

All actions associated with the future will be called in the context of the function calling fulfull.

The fulfill function is not thread-safe, in the sense, that fulfill calls to the same object made from different threads should be serialized. Note: since fulfill should be called once, it is rarely a case.

val is_fulfilled : 'a t -> bool

is_fulfilled promise is true if associated promise is already fulfilled