From 312e745415d022744f0c464e7ab20643338fd17b Mon Sep 17 00:00:00 2001 From: James Sedgwick Date: Wed, 22 Apr 2015 07:35:31 -0700 Subject: [PATCH] when* -> collect* Summary: title Test Plan: tests Reviewed By: hans@fb.com Subscribers: laser-diffs@, trunkagent, mhl, rhe, fbcode-common-diffs@, chaoyc, search-fbcode-diffs@, hero-diffs@, zeus-diffs@, vikas, cold-storage-diffs@, rtgw-diffs@, unicorn-diffs@, targeting-diff-backend@, netego-diffs@, apollo-diffs@, everstore-dev@, zhuohuang, zhguo, jying, darshan, apodsiadlo, alikhtarov, folly-diffs@, wch, lins, tingy, jsedgwick, thom, yfeldblum, petchean, iaroslav, qhuang, gus, san, tomasz, pknowles, lyang, chalfant, paggarw, stevenkim FB internal diff: D2003300 Tasks: 6025255 Signature: t1:2003300:1429659170:e18999cba45e8aa9019aa94f1f29732076a274ad --- folly/experimental/fibers/WhenN-inl.h | 16 +++--- folly/experimental/fibers/WhenN.h | 16 +++--- folly/experimental/fibers/test/FibersTest.cpp | 30 +++++------ folly/futures/Future-inl.h | 18 +++---- folly/futures/Future.h | 10 ++-- folly/futures/README.md | 8 +-- folly/futures/detail/Core.h | 6 +-- folly/futures/test/FutureTest.cpp | 50 +++++++++---------- 8 files changed, 77 insertions(+), 77 deletions(-) diff --git a/folly/experimental/fibers/WhenN-inl.h b/folly/experimental/fibers/WhenN-inl.h index 137dd9f9..d931e16c 100644 --- a/folly/experimental/fibers/WhenN-inl.h +++ b/folly/experimental/fibers/WhenN-inl.h @@ -33,7 +33,7 @@ typename std::vector< typename std::iterator_traits::value_type()>::type> >::type > -whenN(InputIterator first, InputIterator last, size_t n) { +collectN(InputIterator first, InputIterator last, size_t n) { typedef typename std::result_of< typename std::iterator_traits::value_type()>::type Result; assert(n > 0); @@ -96,7 +96,7 @@ typename std::enable_if< typename std::result_of< typename std::iterator_traits::value_type()>::type, void >::value, std::vector>::type -whenN(InputIterator first, InputIterator last, size_t n) { +collectN(InputIterator first, InputIterator last, size_t n) { assert(n > 0); assert(n <= std::distance(first, last)); @@ -160,7 +160,7 @@ typename std::vector< >::value, typename std::result_of< typename std::iterator_traits::value_type()>::type>::type> -inline whenAll(InputIterator first, InputIterator last) { +inline collectAll(InputIterator first, InputIterator last) { typedef typename std::result_of< typename std::iterator_traits::value_type()>::type Result; size_t n = std::distance(first, last); @@ -191,7 +191,7 @@ typename std::enable_if< typename std::result_of< typename std::iterator_traits::value_type()>::type, void >::value, void>::type -inline whenAll(InputIterator first, InputIterator last) { +inline collectAll(InputIterator first, InputIterator last) { forEach(first, last, [] (size_t id) {}); } @@ -206,8 +206,8 @@ typename std::enable_if< typename std::result_of< typename std::iterator_traits::value_type()>::type> >::type -inline whenAny(InputIterator first, InputIterator last) { - auto result = whenN(first, last, 1); +inline collectAny(InputIterator first, InputIterator last) { + auto result = collectN(first, last, 1); assert(result.size() == 1); return std::move(result[0]); } @@ -218,8 +218,8 @@ typename std::enable_if< typename std::result_of< typename std::iterator_traits::value_type()>::type, void >::value, size_t>::type -inline whenAny(InputIterator first, InputIterator last) { - auto result = whenN(first, last, 1); +inline collectAny(InputIterator first, InputIterator last) { + auto result = collectN(first, last, 1); assert(result.size() == 1); return std::move(result[0]); } diff --git a/folly/experimental/fibers/WhenN.h b/folly/experimental/fibers/WhenN.h index 8d11eb21..420eef10 100644 --- a/folly/experimental/fibers/WhenN.h +++ b/folly/experimental/fibers/WhenN.h @@ -42,10 +42,10 @@ typename std::vector< typename std::iterator_traits::value_type()>::type> >::type > -inline whenN(InputIterator first, InputIterator last, size_t n); +inline collectN(InputIterator first, InputIterator last, size_t n); /** - * whenN specialization for functions returning void + * collectN specialization for functions returning void * * @param first Range of tasks to be scheduled * @param last @@ -59,7 +59,7 @@ typename std::enable_if< typename std::result_of< typename std::iterator_traits::value_type()>::type, void >::value, std::vector>::type -inline whenN(InputIterator first, InputIterator last, size_t n); +inline collectN(InputIterator first, InputIterator last, size_t n); /** * Schedules several tasks and blocks until all of these tasks are completed. @@ -82,10 +82,10 @@ typename std::vector< typename std::result_of< typename std::iterator_traits::value_type()>::type>::type > -inline whenAll(InputIterator first, InputIterator last); +inline collectAll(InputIterator first, InputIterator last); /** - * whenAll specialization for functions returning void + * collectAll specialization for functions returning void * * @param first Range of tasks to be scheduled * @param last @@ -96,7 +96,7 @@ typename std::enable_if< typename std::result_of< typename std::iterator_traits::value_type()>::type, void >::value, void>::type -inline whenAll(InputIterator first, InputIterator last); +inline collectAll(InputIterator first, InputIterator last); /** * Schedules several tasks and blocks until one of them is completed. @@ -119,7 +119,7 @@ typename std::enable_if< typename std::result_of< typename std::iterator_traits::value_type()>::type> >::type -inline whenAny(InputIterator first, InputIterator last); +inline collectAny(InputIterator first, InputIterator last); /** * WhenAny specialization for functions returning void. @@ -135,7 +135,7 @@ typename std::enable_if< typename std::result_of< typename std::iterator_traits::value_type()>::type, void >::value, size_t>::type -inline whenAny(InputIterator first, InputIterator last); +inline collectAny(InputIterator first, InputIterator last); }} diff --git a/folly/experimental/fibers/test/FibersTest.cpp b/folly/experimental/fibers/test/FibersTest.cpp index 41d789ec..72f351cc 100644 --- a/folly/experimental/fibers/test/FibersTest.cpp +++ b/folly/experimental/fibers/test/FibersTest.cpp @@ -602,7 +602,7 @@ TEST(FiberManager, forEach) { loopController.loop(std::move(loopFunc)); } -TEST(FiberManager, whenN) { +TEST(FiberManager, collectN) { std::vector> pendingFibers; bool taskAdded = false; @@ -626,7 +626,7 @@ TEST(FiberManager, whenN) { ); } - auto results = whenN(funcs.begin(), funcs.end(), 2); + auto results = collectN(funcs.begin(), funcs.end(), 2); EXPECT_EQ(2, results.size()); EXPECT_EQ(1, pendingFibers.size()); for (size_t i = 0; i < 2; ++i) { @@ -646,7 +646,7 @@ TEST(FiberManager, whenN) { loopController.loop(std::move(loopFunc)); } -TEST(FiberManager, whenNThrow) { +TEST(FiberManager, collectNThrow) { std::vector> pendingFibers; bool taskAdded = false; @@ -672,7 +672,7 @@ TEST(FiberManager, whenNThrow) { } try { - whenN(funcs.begin(), funcs.end(), 2); + collectN(funcs.begin(), funcs.end(), 2); } catch (...) { EXPECT_EQ(1, pendingFibers.size()); } @@ -690,7 +690,7 @@ TEST(FiberManager, whenNThrow) { loopController.loop(std::move(loopFunc)); } -TEST(FiberManager, whenNVoid) { +TEST(FiberManager, collectNVoid) { std::vector> pendingFibers; bool taskAdded = false; @@ -713,7 +713,7 @@ TEST(FiberManager, whenNVoid) { ); } - auto results = whenN(funcs.begin(), funcs.end(), 2); + auto results = collectN(funcs.begin(), funcs.end(), 2); EXPECT_EQ(2, results.size()); EXPECT_EQ(1, pendingFibers.size()); } @@ -730,7 +730,7 @@ TEST(FiberManager, whenNVoid) { loopController.loop(std::move(loopFunc)); } -TEST(FiberManager, whenNVoidThrow) { +TEST(FiberManager, collectNVoidThrow) { std::vector> pendingFibers; bool taskAdded = false; @@ -755,7 +755,7 @@ TEST(FiberManager, whenNVoidThrow) { } try { - whenN(funcs.begin(), funcs.end(), 2); + collectN(funcs.begin(), funcs.end(), 2); } catch (...) { EXPECT_EQ(1, pendingFibers.size()); } @@ -773,7 +773,7 @@ TEST(FiberManager, whenNVoidThrow) { loopController.loop(std::move(loopFunc)); } -TEST(FiberManager, whenAll) { +TEST(FiberManager, collectAll) { std::vector> pendingFibers; bool taskAdded = false; @@ -797,7 +797,7 @@ TEST(FiberManager, whenAll) { ); } - auto results = whenAll(funcs.begin(), funcs.end()); + auto results = collectAll(funcs.begin(), funcs.end()); EXPECT_TRUE(pendingFibers.empty()); for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(i*2+1, results[i]); @@ -816,7 +816,7 @@ TEST(FiberManager, whenAll) { loopController.loop(std::move(loopFunc)); } -TEST(FiberManager, whenAllVoid) { +TEST(FiberManager, collectAllVoid) { std::vector> pendingFibers; bool taskAdded = false; @@ -839,7 +839,7 @@ TEST(FiberManager, whenAllVoid) { ); } - whenAll(funcs.begin(), funcs.end()); + collectAll(funcs.begin(), funcs.end()); EXPECT_TRUE(pendingFibers.empty()); } ); @@ -855,7 +855,7 @@ TEST(FiberManager, whenAllVoid) { loopController.loop(std::move(loopFunc)); } -TEST(FiberManager, whenAny) { +TEST(FiberManager, collectAny) { std::vector> pendingFibers; bool taskAdded = false; @@ -882,7 +882,7 @@ TEST(FiberManager, whenAny) { ); } - auto result = whenAny(funcs.begin(), funcs.end()); + auto result = collectAny(funcs.begin(), funcs.end()); EXPECT_EQ(2, pendingFibers.size()); EXPECT_EQ(2, result.first); EXPECT_EQ(2*2+1, result.second); @@ -1255,7 +1255,7 @@ void testFiberLocal() { local().value = 44; }; std::vector> tasks{task}; - whenAny(tasks.begin(), tasks.end()); + collectAny(tasks.begin(), tasks.end()); EXPECT_EQ(43, local().value); }); diff --git a/folly/futures/Future-inl.h b/folly/futures/Future-inl.h index 86883c6f..f141b268 100644 --- a/folly/futures/Future-inl.h +++ b/folly/futures/Future-inl.h @@ -549,12 +549,12 @@ Future via(Executor* executor) { template typename detail::VariadicContext< typename std::decay::type::value_type...>::type -whenAll(Fs&&... fs) { +collectAll(Fs&&... fs) { auto ctx = new detail::VariadicContext::type::value_type...>(); ctx->total = sizeof...(fs); auto f_saved = ctx->p.getFuture(); - detail::whenAllVariadicHelper(ctx, + detail::collectAllVariadicHelper(ctx, std::forward::type>(fs)...); return f_saved; } @@ -565,7 +565,7 @@ template Future< std::vector< Try::value_type::value_type>>> -whenAll(InputIterator first, InputIterator last) { +collectAll(InputIterator first, InputIterator last) { typedef typename std::iterator_traits::value_type::value_type T; @@ -727,7 +727,7 @@ Future< Try< typename std::iterator_traits::value_type::value_type> > > -whenAny(InputIterator first, InputIterator last) { +collectAny(InputIterator first, InputIterator last) { typedef typename std::iterator_traits::value_type::value_type T; @@ -750,7 +750,7 @@ whenAny(InputIterator first, InputIterator last) { template Future::value_type::value_type>>>> -whenN(InputIterator first, InputIterator last, size_t n) { +collectN(InputIterator first, InputIterator last, size_t n) { typedef typename std::iterator_traits::value_type::value_type T; typedef std::vector>> V; @@ -801,7 +801,7 @@ reduce(It first, It last, T initial, F func) { typedef isTry IsTry; - return whenAll(first, last) + return collectAll(first, last) .then([initial, func](std::vector>& vals) mutable { for (auto& val : vals) { initial = func(std::move(initial), @@ -828,7 +828,7 @@ reduce(It first, It last, T initial, F func) { }); for (++first; first != last; ++first) { - f = whenAll(f, *first).then([func](std::tuple, Try>& t) { + f = collectAll(f, *first).then([func](std::tuple, Try>& t) { return func(std::move(std::get<0>(t).value()), // Either return a ItT&& or a Try&& depending // on the type of the argument of func. @@ -882,7 +882,7 @@ Future Future::within(Duration dur, E e, Timekeeper* tk) { template Future Future::delayed(Duration dur, Timekeeper* tk) { - return whenAll(*this, futures::sleep(dur, tk)) + return collectAll(*this, futures::sleep(dur, tk)) .then([](std::tuple, Try> tup) { Try& t = std::get<0>(tup); return makeFuture(std::move(t)); @@ -1019,7 +1019,7 @@ inline void Future::getVia(DrivableExecutor* e) { template Future Future::willEqual(Future& f) { - return whenAll(*this, f).then([](const std::tuple, Try>& t) { + return collectAll(*this, f).then([](const std::tuple, Try>& t) { if (std::get<0>(t).hasValue() && std::get<1>(t).hasValue()) { return std::get<0>(t).value() == std::get<1>(t).value(); } else { diff --git a/folly/futures/Future.h b/folly/futures/Future.h index 4bd12403..2df34b79 100644 --- a/folly/futures/Future.h +++ b/folly/futures/Future.h @@ -641,7 +641,7 @@ Future via(Executor* executor); template Future::value_type::value_type>>> -whenAll(InputIterator first, InputIterator last); +collectAll(InputIterator first, InputIterator last); /// This version takes a varying number of Futures instead of an iterator. /// The return type for (Future, Future, ...) input @@ -650,9 +650,9 @@ whenAll(InputIterator first, InputIterator last); template typename detail::VariadicContext< typename std::decay::type::value_type...>::type -whenAll(Fs&&... fs); +collectAll(Fs&&... fs); -/// Like whenAll, but will short circuit on the first exception. Thus, the +/// Like collectAll, but will short circuit on the first exception. Thus, the /// type of the returned Future is std::vector instead of /// std::vector> template @@ -671,7 +671,7 @@ template Future::value_type::value_type>>> -whenAny(InputIterator first, InputIterator last); +collectAny(InputIterator first, InputIterator last); /** when n Futures have completed, the Future completes with a vector of the index and Try of those n Futures (the indices refer to the original @@ -683,7 +683,7 @@ template Future::value_type::value_type>>>> -whenN(InputIterator first, InputIterator last, size_t n); +collectN(InputIterator first, InputIterator last, size_t n); template using MaybeTryArg = typename std::conditional< diff --git a/folly/futures/README.md b/folly/futures/README.md index 741fa234..f0aaa3d2 100644 --- a/folly/futures/README.md +++ b/folly/futures/README.md @@ -2,7 +2,7 @@ Futures is a futures-based async framework inspired by [Twitter's Finagle](http://twitter.github.io/finagle/) (which is in scala), and (loosely) building upon the existing (but anemic) Futures code found in the C++11 standard ([`std::future`](http://en.cppreference.com/w/cpp/thread/future)) and [`boost::future`](http://www.boost.org/doc/libs/1_53_0/boost/thread/future.hpp) (especially >= 1.53.0). Although inspired by the std::future interface, it is not syntactically drop-in compatible because some ideas didn't translate well enough and we decided to break from the API. But semantically, it should be straightforward to translate from existing std::future code to Futures. -The primary semantic differences are that folly's Futures and Promises are not threadsafe; and as does `boost::future`, folly::Futures support continuing callbacks (`then()`) and there are helper methods `whenAll()` and `whenAny()` which are important compositional building blocks. +The primary semantic differences are that folly's Futures and Promises are not threadsafe; and as does `boost::future`, folly::Futures support continuing callbacks (`then()`) and there are helper methods `collectAll()` and `collectAny()` which are important compositional building blocks. ## Brief Synopsis @@ -117,16 +117,16 @@ vector> futs; for (auto& key : keys) { futs.push_back(mc.get(key)); } -auto all = whenAll(futs.begin(), futs.end()); +auto all = collectAll(futs.begin(), futs.end()); vector> futs; for (auto& key : keys) { futs.push_back(mc.get(key)); } -auto any = whenAny(futs.begin(), futs.end()); +auto any = collectAny(futs.begin(), futs.end()); ``` -`all` and `any` are Futures (for the exact type and usage see the header files). They will be complete when all/one of `futs` are complete, respectively. (There is also `whenN()` for when you need *some*.) +`all` and `any` are Futures (for the exact type and usage see the header files). They will be complete when all/one of `futs` are complete, respectively. (There is also `collectN()` for when you need *some*.) Second, we can attach callbacks to a Future, and chain them together monadically. An example will clarify: diff --git a/folly/futures/detail/Core.h b/folly/futures/detail/Core.h index f9d18679..85f7b6ca 100644 --- a/folly/futures/detail/Core.h +++ b/folly/futures/detail/Core.h @@ -333,7 +333,7 @@ struct VariadicContext { template typename std::enable_if::type -whenAllVariadicHelper(VariadicContext *ctx, THead&& head, Fs&&... tail) { +collectAllVariadicHelper(VariadicContext *ctx, THead&& head, Fs&&... tail) { head.setCallback_([ctx](Try&& t) { std::get(ctx->results) = std::move(t); if (++ctx->count == ctx->total) { @@ -345,7 +345,7 @@ whenAllVariadicHelper(VariadicContext *ctx, THead&& head, Fs&&... tail) { template typename std::enable_if::type -whenAllVariadicHelper(VariadicContext *ctx, THead&& head, Fs&&... tail) { +collectAllVariadicHelper(VariadicContext *ctx, THead&& head, Fs&&... tail) { head.setCallback_([ctx](Try&& t) { std::get(ctx->results) = std::move(t); if (++ctx->count == ctx->total) { @@ -354,7 +354,7 @@ whenAllVariadicHelper(VariadicContext *ctx, THead&& head, Fs&&... tail) { } }); // template tail-recursion - whenAllVariadicHelper(ctx, std::forward(tail)...); + collectAllVariadicHelper(ctx, std::forward(tail)...); } template diff --git a/folly/futures/test/FutureTest.cpp b/folly/futures/test/FutureTest.cpp index 08f13af1..f2529253 100644 --- a/folly/futures/test/FutureTest.cpp +++ b/folly/futures/test/FutureTest.cpp @@ -689,7 +689,7 @@ TEST(Future, unwrap) { EXPECT_EQ(7, f.value()); } -TEST(Future, whenAll) { +TEST(Future, collectAll) { // returns a vector variant { vector> promises(10); @@ -698,7 +698,7 @@ TEST(Future, whenAll) { for (auto& p : promises) futures.push_back(p.getFuture()); - auto allf = whenAll(futures.begin(), futures.end()); + auto allf = collectAll(futures.begin(), futures.end()); random_shuffle(promises.begin(), promises.end()); for (auto& p : promises) { @@ -721,7 +721,7 @@ TEST(Future, whenAll) { for (auto& p : promises) futures.push_back(p.getFuture()); - auto allf = whenAll(futures.begin(), futures.end()); + auto allf = collectAll(futures.begin(), futures.end()); promises[0].setValue(42); @@ -753,7 +753,7 @@ TEST(Future, whenAll) { for (auto& p : promises) futures.push_back(p.getFuture()); - auto allf = whenAll(futures.begin(), futures.end()) + auto allf = collectAll(futures.begin(), futures.end()) .then([](Try>>&& ts) { for (auto& f : ts.value()) f.value(); @@ -924,7 +924,7 @@ TEST(Future, collectNotDefaultConstructible) { } } -TEST(Future, whenAny) { +TEST(Future, collectAny) { { vector> promises(10); vector> futures; @@ -936,7 +936,7 @@ TEST(Future, whenAny) { EXPECT_FALSE(f.isReady()); } - auto anyf = whenAny(futures.begin(), futures.end()); + auto anyf = collectAny(futures.begin(), futures.end()); /* futures were moved in, so these are invalid now */ EXPECT_FALSE(anyf.isReady()); @@ -964,7 +964,7 @@ TEST(Future, whenAny) { EXPECT_FALSE(f.isReady()); } - auto anyf = whenAny(futures.begin(), futures.end()); + auto anyf = collectAny(futures.begin(), futures.end()); EXPECT_FALSE(anyf.isReady()); @@ -981,7 +981,7 @@ TEST(Future, whenAny) { for (auto& p : promises) futures.push_back(p.getFuture()); - auto anyf = whenAny(futures.begin(), futures.end()) + auto anyf = collectAny(futures.begin(), futures.end()) .then([](pair> p) { EXPECT_EQ(42, p.second.value()); }); @@ -998,7 +998,7 @@ TEST(when, already_completed) { for (int i = 0; i < 10; i++) fs.push_back(makeFuture()); - whenAll(fs.begin(), fs.end()) + collectAll(fs.begin(), fs.end()) .then([&](vector> ts) { EXPECT_EQ(fs.size(), ts.size()); }); @@ -1008,14 +1008,14 @@ TEST(when, already_completed) { for (int i = 0; i < 10; i++) fs.push_back(makeFuture(i)); - whenAny(fs.begin(), fs.end()) + collectAny(fs.begin(), fs.end()) .then([&](pair> p) { EXPECT_EQ(p.first, p.second.value()); }); } } -TEST(when, whenN) { +TEST(when, collectN) { vector> promises(10); vector> futures; @@ -1024,7 +1024,7 @@ TEST(when, whenN) { bool flag = false; size_t n = 3; - whenN(futures.begin(), futures.end(), n) + collectN(futures.begin(), futures.end(), n) .then([&](vector>> v) { flag = true; EXPECT_EQ(n, v.size()); @@ -1055,7 +1055,7 @@ TEST(when, small_vector) { for (int i = 0; i < 10; i++) futures.push_back(makeFuture()); - auto anyf = whenAny(futures.begin(), futures.end()); + auto anyf = collectAny(futures.begin(), futures.end()); } { @@ -1064,17 +1064,17 @@ TEST(when, small_vector) { for (int i = 0; i < 10; i++) futures.push_back(makeFuture()); - auto allf = whenAll(futures.begin(), futures.end()); + auto allf = collectAll(futures.begin(), futures.end()); } } -TEST(Future, whenAllVariadic) { +TEST(Future, collectAllVariadic) { Promise pb; Promise pi; Future fb = pb.getFuture(); Future fi = pi.getFuture(); bool flag = false; - whenAll(std::move(fb), std::move(fi)) + collectAll(std::move(fb), std::move(fi)) .then([&](std::tuple, Try> tup) { flag = true; EXPECT_TRUE(std::get<0>(tup).hasValue()); @@ -1088,13 +1088,13 @@ TEST(Future, whenAllVariadic) { EXPECT_TRUE(flag); } -TEST(Future, whenAllVariadicReferences) { +TEST(Future, collectAllVariadicReferences) { Promise pb; Promise pi; Future fb = pb.getFuture(); Future fi = pi.getFuture(); bool flag = false; - whenAll(fb, fi) + collectAll(fb, fi) .then([&](std::tuple, Try> tup) { flag = true; EXPECT_TRUE(std::get<0>(tup).hasValue()); @@ -1108,9 +1108,9 @@ TEST(Future, whenAllVariadicReferences) { EXPECT_TRUE(flag); } -TEST(Future, whenAll_none) { +TEST(Future, collectAll_none) { vector> fs; - auto f = whenAll(fs.begin(), fs.end()); + auto f = collectAll(fs.begin(), fs.end()); EXPECT_TRUE(f.isReady()); } @@ -1155,13 +1155,13 @@ TEST(Future, waitImmediate) { vector> v_f; v_f.push_back(makeFuture()); v_f.push_back(makeFuture()); - auto done_v_f = whenAll(v_f.begin(), v_f.end()).wait().value(); + auto done_v_f = collectAll(v_f.begin(), v_f.end()).wait().value(); EXPECT_EQ(2, done_v_f.size()); vector> v_fb; v_fb.push_back(makeFuture(true)); v_fb.push_back(makeFuture(false)); - auto fut = whenAll(v_fb.begin(), v_fb.end()); + auto fut = collectAll(v_fb.begin(), v_fb.end()); auto done_v_fb = std::move(fut.wait().value()); EXPECT_EQ(2, done_v_fb.size()); } @@ -1261,7 +1261,7 @@ TEST(Future, waitWithDuration) { vector> v_fb; v_fb.push_back(makeFuture(true)); v_fb.push_back(makeFuture(false)); - auto f = whenAll(v_fb.begin(), v_fb.end()); + auto f = collectAll(v_fb.begin(), v_fb.end()); f.wait(milliseconds(1)); EXPECT_TRUE(f.isReady()); EXPECT_EQ(2, f.value().size()); @@ -1272,7 +1272,7 @@ TEST(Future, waitWithDuration) { Promise p2; v_fb.push_back(p1.getFuture()); v_fb.push_back(p2.getFuture()); - auto f = whenAll(v_fb.begin(), v_fb.end()); + auto f = collectAll(v_fb.begin(), v_fb.end()); f.wait(milliseconds(1)); EXPECT_FALSE(f.isReady()); p1.setValue(true); @@ -1484,7 +1484,7 @@ TEST(Future, t5506504) { for (auto& p : *promises) p.setValue(); }); - return whenAll(futures.begin(), futures.end()); + return collectAll(futures.begin(), futures.end()); }; fn().wait(); -- 2.34.1