Commit 2b4f07ee authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Use InlineExecutor singleton in Future wait

Summary:
[Folly] Use `InlineExecutor` singleton in `Future` wait v.s. letting the executor be `nullptr`.

The effect is the same, but just more explicit.

Reviewed By: marshallcline

Differential Revision: D8306902

fbshipit-source-id: fc90704de670b1ca9956253383fadad3be297847
parent fc75fc56
...@@ -1771,7 +1771,7 @@ namespace detail { ...@@ -1771,7 +1771,7 @@ namespace detail {
template <class FutureType, typename T = typename FutureType::value_type> template <class FutureType, typename T = typename FutureType::value_type>
void waitImpl(FutureType& f) { void waitImpl(FutureType& f) {
if (std::is_base_of<Future<T>, FutureType>::value) { if (std::is_base_of<Future<T>, FutureType>::value) {
f = std::move(f).via(nullptr); f = std::move(f).via(&InlineExecutor::instance());
} }
// short-circuit if there's nothing to do // short-circuit if there's nothing to do
if (f.isReady()) { if (f.isReady()) {
...@@ -1800,7 +1800,7 @@ void convertFuture(SemiFuture<T>&& sf, SemiFuture<T>& f) { ...@@ -1800,7 +1800,7 @@ void convertFuture(SemiFuture<T>&& sf, SemiFuture<T>& f) {
template <class FutureType, typename T = typename FutureType::value_type> template <class FutureType, typename T = typename FutureType::value_type>
void waitImpl(FutureType& f, Duration dur) { void waitImpl(FutureType& f, Duration dur) {
if (std::is_base_of<Future<T>, FutureType>::value) { if (std::is_base_of<Future<T>, FutureType>::value) {
f = std::move(f).via(nullptr); f = std::move(f).via(&InlineExecutor::instance());
} }
// short-circuit if there's nothing to do // short-circuit if there's nothing to do
if (f.isReady()) { if (f.isReady()) {
...@@ -1833,7 +1833,7 @@ void waitViaImpl(Future<T>& f, DrivableExecutor* e) { ...@@ -1833,7 +1833,7 @@ void waitViaImpl(Future<T>& f, DrivableExecutor* e) {
e->drive(); e->drive();
} }
assert(f.isReady()); assert(f.isReady());
f = std::move(f).via(nullptr); f = std::move(f).via(&InlineExecutor::instance());
} }
template <class T, typename Rep, typename Period> template <class T, typename Rep, typename Period>
...@@ -1858,7 +1858,7 @@ void waitViaImpl( ...@@ -1858,7 +1858,7 @@ void waitViaImpl(
} }
assert(f.isReady() || (now >= deadline)); assert(f.isReady() || (now >= deadline));
if (f.isReady()) { if (f.isReady()) {
f = std::move(f).via(nullptr); f = std::move(f).via(&InlineExecutor::instance());
} }
} }
......
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