Commit f9dec043 authored by Pranav Thulasiram Bhat's avatar Pranav Thulasiram Bhat Committed by Facebook GitHub Bot

Add Task<void> specialization for taskWait

Summary:
`folly::coro::blockingWait(...)` returns `void` for `Task<void>`.

This diff implements a template specialization on taskWait for `Task<void>`

Differential Revision: D22265598

fbshipit-source-id: ff13d2b18b8706a6e8257ef706e407b315daf98a
parent bd41a1ed
......@@ -35,6 +35,11 @@ Async<T> taskWait(folly::coro::Task<T>&& task) {
return folly::coro::blockingWait(std::move(task));
}
inline Async<void> taskWait(folly::coro::Task<void>&& task) {
folly::coro::blockingWait(std::move(task));
return {};
}
} // namespace async
} // namespace fibers
} // namespace folly
......@@ -192,6 +192,10 @@ TEST(AsyncTest, asyncTask) {
onFiber());
};
auto voidCoroFn = []() -> folly::coro::Task<void> {
co_await folly::coro::sleep(std::chrono::milliseconds(1));
};
folly::EventBase evb;
auto& fm = getFiberManager(evb);
......@@ -200,6 +204,7 @@ TEST(AsyncTest, asyncTask) {
EXPECT_EQ(
std::make_tuple(std::this_thread::get_id(), true, false),
async::init_await(async::taskWait(coroFn())));
async::init_await(async::taskWait(voidCoroFn()));
})
.getVia(&evb);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment