Commit cc95898a authored by Srivatsan Ramesh's avatar Srivatsan Ramesh Committed by Facebook GitHub Bot

A new NotificationQueue without read limit for server responses

Summary: Using a separate queue for server replies without any limit on the number of items read at once.

Differential Revision: D27090888

fbshipit-source-id: 9df44322e63a3f351a6ab4e723ead083a874b705
parent ab129b5e
...@@ -151,14 +151,6 @@ class ExecutionObserverScopeGuard { ...@@ -151,14 +151,6 @@ class ExecutionObserverScopeGuard {
namespace folly { namespace folly {
class EventBase::FuncRunner {
public:
void operator()(Func&& func) noexcept {
func();
func = nullptr;
}
};
/* /*
* EventBase methods * EventBase methods
*/ */
......
...@@ -143,6 +143,16 @@ class EventBase : public TimeoutManager, ...@@ -143,6 +143,16 @@ class EventBase : public TimeoutManager,
using Func = folly::Function<void()>; using Func = folly::Function<void()>;
class FuncRunner {
public:
void operator()(Func&& func) noexcept {
func();
func = nullptr;
}
};
using EventBaseQueue = EventBaseAtomicNotificationQueue<Func, FuncRunner>;
/** /**
* A callback interface to use with runInLoop() * A callback interface to use with runInLoop()
* *
...@@ -855,8 +865,6 @@ class EventBase : public TimeoutManager, ...@@ -855,8 +865,6 @@ class EventBase : public TimeoutManager,
} }
private: private:
class FuncRunner;
folly::VirtualEventBase* tryGetVirtualEventBase(); folly::VirtualEventBase* tryGetVirtualEventBase();
void applyLoopKeepAlive(); void applyLoopKeepAlive();
...@@ -906,7 +914,7 @@ class EventBase : public TimeoutManager, ...@@ -906,7 +914,7 @@ class EventBase : public TimeoutManager,
// A notification queue for runInEventBaseThread() to use // A notification queue for runInEventBaseThread() to use
// to send function requests to the EventBase thread. // to send function requests to the EventBase thread.
std::unique_ptr<EventBaseAtomicNotificationQueue<Func, FuncRunner>> queue_; std::unique_ptr<EventBaseQueue> queue_;
ssize_t loopKeepAliveCount_{0}; ssize_t loopKeepAliveCount_{0};
std::atomic<ssize_t> loopKeepAliveCountAtomic_{0}; std::atomic<ssize_t> loopKeepAliveCountAtomic_{0};
bool loopKeepAliveActive_{false}; bool loopKeepAliveActive_{false};
......
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