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

Make keepAliveRelease consistent between EventBase and VirtualEventBase

Summary: [Folly] Make `keepAliveRelease` consistent between `EventBase` and `VirtualEventBase`.

Reviewed By: elsteveogrande

Differential Revision: D5982132

fbshipit-source-id: 536d48e5672567e78786691bfb283c34d1f31960
parent 74570190
......@@ -654,11 +654,10 @@ class EventBase : private boost::noncopyable,
}
void keepAliveRelease() override {
if (inRunningEventBaseThread()) {
loopKeepAliveCount_--;
} else {
add([=] { loopKeepAliveCount_--; });
if (!inRunningEventBaseThread()) {
return add([=] { keepAliveRelease(); });
}
loopKeepAliveCount_--;
}
private:
......
......@@ -140,8 +140,8 @@ class VirtualEventBase : public folly::Executor, public folly::TimeoutManager {
}
void keepAliveRelease() override {
if (!getEventBase().inRunningEventBaseThread()) {
return getEventBase().add([=] { keepAliveRelease(); });
if (!inRunningEventBaseThread()) {
return add([=] { keepAliveRelease(); });
}
if (loopKeepAliveCountAtomic_.load()) {
loopKeepAliveCount_ += loopKeepAliveCountAtomic_.exchange(0);
......
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