Commit c911d883 authored by Zachary Collins's avatar Zachary Collins Committed by Facebook GitHub Bot

change IOExecutorThreadPool such that observer logic can be overriden

Summary: We want to have a custom `IOExecutorThreadPool` that performs different logic for handling observers being adding or not. This change makes it so the functions and structs necessary to do so can be properly overriden.

Reviewed By: Gownta

Differential Revision: D32101852

fbshipit-source-id: 2f1c6bb4c00d41630891aa72b8e519708cb1a40f
parent e7eb2bb6
......@@ -88,7 +88,7 @@ class IOThreadPoolExecutor : public ThreadPoolExecutor, public IOExecutor {
folly::EventBaseManager* getEventBaseManager();
private:
protected:
struct alignas(Thread) IOThread : public Thread {
IOThread(IOThreadPoolExecutor* pool)
: Thread(pool), shouldRun(true), pendingTasks(0) {}
......@@ -98,6 +98,7 @@ class IOThreadPoolExecutor : public ThreadPoolExecutor, public IOExecutor {
std::mutex eventBaseShutdownMutex_;
};
private:
ThreadPtr makeThread() override;
std::shared_ptr<IOThread> pickThread();
void threadRun(ThreadPtr thread) override;
......
......@@ -172,8 +172,8 @@ class ThreadPoolExecutor : public DefaultKeepAliveExecutor {
virtual ~Observer() = default;
};
void addObserver(std::shared_ptr<Observer>);
void removeObserver(std::shared_ptr<Observer>);
virtual void addObserver(std::shared_ptr<Observer>);
virtual void removeObserver(std::shared_ptr<Observer>);
void setThreadDeathTimeout(std::chrono::milliseconds timeout) {
threadTimeout_ = timeout;
......
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