module Make:
| Parameters: |
|
type 'a t
val create : unit -> 'a tval enqueue : 'a t ->
key:Key.t -> ('a option -> 'b Import.Deferred.t) -> 'b Import.Deferred.tenqueue t ~key f enqueues f for key. f will be called with the state of
key when invoked.
Invariant 1: it is guaranteed that f will not be called immediately.
Invariant 2: if f raises, then the exception will be raised to the monitor in
effect when enqueue was called. Subsequent jobs for key will proceed.
Invariant 3: to avoid race, there are no deferred operations between finding the
state and calling f with the state found. Otherwise, the user would need to
consider the race that the state passed to f might have been changed by
set_state.
val set_state : 'a t -> key:Key.t -> 'a option -> unitset_state t key state_opt sets the state for key immediately. The state will be
kept internally until set to Noneval find_state : 'a t -> Key.t -> 'a optionval num_unfinished_jobs : 'a t -> Key.t -> intnum_unfinished_jobs t key returns the number of jobs for key including including
pending and running.val mem : 'a t -> Key.t -> boolmem t key returns true if there is state or an pending/running jobval fold : 'a t ->
init:'b -> f:('b -> key:Key.t -> 'a option -> 'b) -> 'benqueue
or set_state) when folding