Skip to content

Commit

Permalink
A shorter name for executor local variable in Future methods
Browse files Browse the repository at this point in the history
Summary:
[Folly] A shorter name for executor local variable in `Future` methods. Reads more nicely, with less awkward formatting.

When the scope of a local variable's use is just a few lines, long names are not quite so critical.

Reviewed By: marshallcline

Differential Revision: D8339451

fbshipit-source-id: 5d50cf0ce3473c1a79afeeddb9e1257cccf73e31
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Jun 9, 2018
1 parent ac16a6f commit 467571e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions folly/futures/Future-inl.h
Expand Up @@ -1736,11 +1736,9 @@ Future<T> Future<T>::within(Duration dur, E e, Timekeeper* tk) {
return std::move(*this);
}

auto* currentExecutor = this->getExecutor();
auto* exe = this->getExecutor();
return this->withinImplementation(dur, e, tk)
.via(
currentExecutor ? currentExecutor
: &InlineExecutor::instance());
.via(exe ? exe : &InlineExecutor::instance());
}

// delayed
Expand Down Expand Up @@ -1787,9 +1785,8 @@ void waitImpl(FutureType& f) {
template <class T>
void convertFuture(SemiFuture<T>&& sf, Future<T>& f) {
// Carry executor from f, inserting an inline executor if it did not have one
auto* currentExecutor = f.getExecutor();
f = std::move(sf).via(
currentExecutor ? currentExecutor : &InlineExecutor::instance());
auto* exe = f.getExecutor();
f = std::move(sf).via(exe ? exe : &InlineExecutor::instance());
}

template <class T>
Expand Down

0 comments on commit 467571e

Please sign in to comment.