Module JoinCount.Dynamic

module Dynamic: sig .. end
Dynamic collectors

type ('a, 'b) t = {
   enter : unit -> unit;
   leave : 'a Join.chan;
   wait : unit -> 'b;
   finished : unit Join.chan;
Dynamic collectors are refinement of simple collectors, for which the number of events to collect need not be given in advance.

Given a dynamic collector c, defined as create comb y0:

Then the call c.wait() will return the combined result comb x1 (comb x2 (... (comb xn y0))), once all the announced events have occurred. Observe that at most one such call is allowed.
val create : ('a -> 'b -> 'b) -> 'b -> ('a, 'b) t
create comb y0 returns a dynamic collector of events of type 'a, with combining function comb and initial result y0.