Commit 216aaafc authored by Tristan Rice's avatar Tristan Rice Committed by Facebook Github Bot

folly: within - grab executor keepalive before moving

Summary: Previous within changes changed how long the executor keepalive existed for. This explicitly grabs the executor keepalive before calling within to ensure it still exists when we try to use it in `via`.

Reviewed By: LeeHowes

Differential Revision: D17054622

fbshipit-source-id: 7826c6ac0ad332a8f5f1331cd2d798619cf318c3
parent 986ce3f1
......@@ -2013,11 +2013,10 @@ Future<T> Future<T>::within(Duration dur, E e, Timekeeper* tk) && {
return std::move(*this);
}
auto* exe = this->getExecutor();
return std::move(*this)
.semi()
.within(dur, e, tk)
.via(exe ? exe : &InlineExecutor::instance());
auto* ePtr = this->getExecutor();
auto exe =
folly::getKeepAliveToken(ePtr ? *ePtr : InlineExecutor::instance());
return std::move(*this).semi().within(dur, e, tk).via(std::move(exe));
}
template <class T>
......
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