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

DefaultKeepAliveExecutor::reset

Summary: [Folly] `DefaultKeepAliveExecutor::reset` in case of restartable executors.

Reviewed By: andriigrynenko

Differential Revision: D14236173

fbshipit-source-id: 14f71af6bd54777770fdfe6036a4137af4e884bc
parent c2a61864
...@@ -46,6 +46,15 @@ class DefaultKeepAliveExecutor : public virtual Executor { ...@@ -46,6 +46,15 @@ class DefaultKeepAliveExecutor : public virtual Executor {
keepAliveReleaseBaton_.wait(); keepAliveReleaseBaton_.wait();
} }
void joinAndResetKeepAlive() {
joinKeepAlive();
auto keepAliveCount =
controlBlock_->keepAliveCount_.exchange(1, std::memory_order_relaxed);
DCHECK_EQ(keepAliveCount, 0);
keepAliveReleaseBaton_.reset();
keepAlive_ = makeKeepAlive(this);
}
private: private:
struct ControlBlock { struct ControlBlock {
std::atomic<ssize_t> keepAliveCount_{1}; std::atomic<ssize_t> keepAliveCount_{1};
......
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