Commit 6fdeaeba authored by Hans Fugal's avatar Hans Fugal Committed by Dave Watson

Replace Later in tcc

Summary:
s/`sendAsyncLater`/`sendAsyncVia`/ and change it to return a cold future with equivalent semantics. We have to call `via` twice in the implementation—once to gate the result and again to make sure the caller will get a future that executes in that executor's context also.

NB this is a slight semantic change - if the executor is, say, a threadpool then now it will go through the threadpool queue (and maybe execute in two different threads) whereas before the whole later chain would execute in the same thread. I don't *think* this is a problem, but something to think about.

Test Plan:
stuff we fbconfig'd builds
contbuild
unit tests
thinking really hard

Reviewed By: hannesr@fb.com

Subscribers: trunkagent, fbcode-common-diffs@, net-systems@, ldbrandy, hannesr, fugalh, zhuohuang, exa, watashi, smarlow, akr, bnitka, jcoens, darshan, njormrod, anfarmer, folly-diffs@

FB internal diff: D1644012

Tasks: 5409538

Signature: t1:1644012:1417625401:99b1b7df6de4cfcdd945eed7104d4c82e8c0b78f
parent c5dea7b6
...@@ -308,11 +308,21 @@ class Future { ...@@ -308,11 +308,21 @@ class Future {
/// by then), and it is active (active by default). /// by then), and it is active (active by default).
/// ///
/// Inactive Futures will activate upon destruction. /// Inactive Futures will activate upon destruction.
void activate() { Future<T>& activate() & {
core_->activate(); core_->activate();
return *this;
} }
void deactivate() { Future<T>& deactivate() & {
core_->deactivate(); core_->deactivate();
return *this;
}
Future<T> activate() && {
core_->activate();
return std::move(*this);
}
Future<T> deactivate() && {
core_->deactivate();
return std::move(*this);
} }
bool isActive() { bool isActive() {
return core_->isActive(); return core_->isActive();
......
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