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

Fix move-of-const in ThreadWheelTimekeeper

Summary: [Folly] Fix move-of-const in `ThreadWheelTimekeeper`.

Reviewed By: capickett

Differential Revision: D9950653

fbshipit-source-id: 76d45cdac1026c41de73489936c4afdac3f57fd7
parent 2f214cc1
...@@ -81,14 +81,15 @@ struct WTCallback : public std::enable_shared_from_this<WTCallback>, ...@@ -81,14 +81,15 @@ struct WTCallback : public std::enable_shared_from_this<WTCallback>,
// This is not racing with timeoutExpired anymore because this is called // This is not racing with timeoutExpired anymore because this is called
// through Future, which means Core is still alive and keeping a ref count // through Future, which means Core is still alive and keeping a ref count
// on us, so what timeouExpired is doing won't make the object go away // on us, so what timeouExpired is doing won't make the object go away
base_->runInEventBaseThread([me = shared_from_this(), ew = std::move(ew)] { base_->runInEventBaseThread(
me->cancelTimeout(); [me = shared_from_this(), ew = std::move(ew)]() mutable {
// Don't need Promise anymore, break the circular reference me->cancelTimeout();
auto promise = me->stealPromise(); // Don't need Promise anymore, break the circular reference
if (!promise.isFulfilled()) { auto promise = me->stealPromise();
promise.setException(std::move(ew)); if (!promise.isFulfilled()) {
} promise.setException(std::move(ew));
}); }
});
} }
}; };
......
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