collectAll overloads

Synopses

Declared in <folly/fibers/async/Collect.h>

collectAll version that takes a container instead of iterators for convenience

template<class Collection>
decltype(collectAll(c.begin(), c.end()))
collectAll(Collection&& c);

collectAll version that takes a varying number of functors instead of a container or iterators

Schedules several async annotated functors and blocks until all of these are completed. If any of the functors throws an exception, this exception will be re‐thrown, but only when all the tasks are complete. If several throw exceptions one of them will be re‐thrown.

template<
    class InputIterator,
    typename FuncType = std::iterator_traits<InputIterator>::value_type,
    typename ResultType = std::invoke_result_t<FuncType>>
Async<std::vector<async_inner_type_t<ResultType>>>
collectAll(
    InputIterator first,
    InputIterator last);

collectAll specialization for functions returning void

template<
    class InputIterator,
    typename FuncType = std::iterator_traits<InputIterator>::value_type,
    typename ResultType = std::invoke_result_t<FuncType>>
Async<void>
collectAll(
    InputIterator first,
    InputIterator last)
requires std::is_same<ResultType, Async<void>>::value;

Return Value

  • A vector of the results of the functors

  • A tuple of the results of the functors

  • An Async<void> that completes when all functors have completed

Parameters

Name

Description

c

Container of async‐annotated functors to schedule and await

tasks

Async‐annotated functors to schedule and await

first

Beginning of the range of functors to schedule and await

last

End of the range of functors to schedule and await

Created with MrDocs