70 std::shared_ptr<ThreadFactory> threadFactory =
71 std::make_shared<NamedThreadFactory>(
"CPUThreadPool"));
74 std::pair<size_t, size_t> numThreads,
76 std::shared_ptr<ThreadFactory> threadFactory =
77 std::make_shared<NamedThreadFactory>(
"CPUThreadPool"));
83 std::shared_ptr<ThreadFactory> threadFactory);
86 std::pair<size_t, size_t> numThreads,
87 std::shared_ptr<ThreadFactory> threadFactory);
92 std::shared_ptr<ThreadFactory> threadFactory =
93 std::make_shared<NamedThreadFactory>(
"CPUThreadPool"));
99 std::shared_ptr<ThreadFactory> threadFactory =
100 std::make_shared<NamedThreadFactory>(
"CPUThreadPool"));
108 Func expireCallback =
nullptr)
override;
114 std::chrono::milliseconds expiration,
115 Func expireCallback =
nullptr);
126 std::chrono::milliseconds expiration,
127 Func&& expireCallback)
CPUTask(Func &&f, std::chrono::milliseconds expiration, Func &&expireCallback)
DECLARE_bool(dynamic_cputhreadpoolexecutor)
void addWithPriority(Func func, int8_t priority) override
std::unique_ptr< BlockingQueue< CPUTask > > taskQueue_
constexpr detail::Map< Move > move
void stopThreads(size_t n) override
uint8_t getNumPriorities() const override
—— Concurrent Priority Queue Implementation ——
std::shared_ptr< Thread > ThreadPtr
size_t getTaskQueueSize() const
bool taskShouldStop(folly::Optional< CPUTask > &)
BlockingQueue< CPUTask > * getTaskQueue()
~CPUThreadPoolExecutor() override
void threadRun(ThreadPtr thread) override
void add(Func func) override
CPUThreadPoolExecutor(size_t numThreads, std::unique_ptr< BlockingQueue< CPUTask >> taskQueue, std::shared_ptr< ThreadFactory > threadFactory=std::make_shared< NamedThreadFactory >("CPUThreadPool"))
static const size_t kDefaultMaxQueueSize
size_t getPendingTaskCountImpl() override
std::atomic< ssize_t > threadsToStop_