Module Fut.Advanced

val barrier_on_abstract_container_of_futures : iter:(('a t -> unit) -> 'cont -> unit) -> len:('cont -> int) -> aggregate_results:(('a t -> 'a) -> 'cont -> 'res) -> 'cont -> 'res t

barrier_on_abstract_container_of_futures ~iter ~aggregate_results ~len cont takes a container of futures (cont), with len elements, and returns a future result of type res (possibly another type of container).

This waits for all futures in cont: 'cont to be done (futures obtained via iter <some function> cont). If they all succeed, their results are aggregated into a new result of type 'res via aggregate_results <some function> cont.

NOTE: the behavior is not specified if iter f cont (for a function f) doesn't call f on exactly len cont elements.

  • since 0.5.1