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