Make keepAliveRelease consistent between EventBase and VirtualEventBase
[folly.git] / folly / io / async / EventBase.h
index 9df035235a7d60946a28c014cf239c55728edbf5..fff75adb00527d7938c528a07b4894ff4d730ef5 100644 (file)
@@ -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: