56 std::shared_ptr<ThreadFactory> threadFactory =
57 std::make_shared<NamedThreadFactory>(
"IOThreadPool"),
59 bool waitForAll =
false);
67 Func expireCallback =
nullptr)
override;
76 struct alignas(hardware_destructive_interference_size)
IOThread 79 :
Thread(pool), shouldRun(true), pendingTasks(0) {}
std::atomic< size_t > nextThread_
ThreadPtr makeThread() override
folly::EventBaseManager * getEventBaseManager()
—— Concurrent Priority Queue Implementation ——
std::shared_ptr< Thread > ThreadPtr
size_t getPendingTaskCountImpl() override
static EventBaseManager * get()
void threadRun(ThreadPtr thread) override
std::atomic< size_t > pendingTasks
void add(Func func) override
std::atomic< bool > shouldRun
folly::EventBaseManager * eventBaseManager_
~IOThreadPoolExecutor() override
folly::EventBase * getEventBase() override
folly::ThreadLocal< std::shared_ptr< IOThread > > thisThread_
IOThreadPoolExecutor(size_t numThreads, std::shared_ptr< ThreadFactory > threadFactory=std::make_shared< NamedThreadFactory >("IOThreadPool"), folly::EventBaseManager *ebm=folly::EventBaseManager::get(), bool waitForAll=false)
IOThread(IOThreadPoolExecutor *pool)
std::mutex eventBaseShutdownMutex_
void stopThreads(size_t n) override
folly::EventBase * eventBase
std::shared_ptr< IOThread > pickThread()