Module JoinCount.Monitor

module Monitor: sig .. end

type key 
Type for identifiers of pending computations.
type ('a, 'b, 'c) t = {
   enter : 'a -> key;
   leave : key * 'b -> unit;
   is_pending : key -> bool;
   get_pendings : unit -> (key * 'a) list;
   wait : unit -> 'c;
   finished : unit Join.chan;
Monitiors are enhancements of dynamic collectors adding the ability to access the list of pending computations.

Given a monitor m, defined as create comb y0:

The call m.wait () will return the combined result comb y1 (comb y2 (... (comb yn y0))), once all the announced events have occurred. Observe that at most one such call is allowed.
val create : ('b -> 'c -> 'c) -> 'c -> ('a, 'b, 'c) t
create comb y0 returns a monitor for computations of type 'a -> 'b, comb being used to combine results with initial result y0.