~smspillaz/folly/folly-git-master

Viewing all changes in revision 6819.

  • Committer: Facebook Github Bot
  • Author(s): Lewis Baker
  • Date: 2019-03-19 21:21:59 UTC
  • Revision ID: git-v1:3874d4233f52913e000a73dc0e7442106e21c4fa
Add variadic folly::coro::collectAlll() and collectAllTry()

Summary:
Adds two new functions to folly::coro for concurrently awaiting a fixed number of sub-tasks.

* `folly::coro::collectAll(tasks...)`
* `folly::coro::collectAllTry(tasks...)`

Both can be used to concurrently await multiple input tasks. The difference is in how they report the results.

`collectAll()` produces a tuple of the result values for each of the input operations. If any of the input operations fails with an exception then the whole operation fails with an exception (which one is unspecified) any successful results are discarded.

`collectAllTry()` produces a tuple of `Try<T>` objects regardless of whether any of the input operations failed with an exception. The individual result objects can then be queried for the success/failure, allowing the caller to handle partial failure and/or determine which operation(s) failed.

Reviewed By: andriigrynenko

Differential Revision: D14334714

fbshipit-source-id: 22eb51e2198be42e77677a066bfbc15e1c7eb7dd

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: