Commit 322caefa authored by Murali Vilayannur's avatar Murali Vilayannur Committed by Facebook Github Bot

CPUThreadPoolExecutor constructor variant that takes min and max threads

Summary:
Diff exposes a more convenient constructor interface
in CPUThreadPoolExecutor that is analogous to the existing constructor
interface with the only exception that it takes a pair of min and max
number of threads that drives the executor.

Reviewed By: djwatson

Differential Revision: D8088545

fbshipit-source-id: 3ee92070335267948332ef75d67817d25436262f
parent ce1e74c5
......@@ -59,6 +59,15 @@ CPUThreadPoolExecutor::CPUThreadPoolExecutor(
CPUThreadPoolExecutor::kDefaultMaxQueueSize),
std::move(threadFactory)) {}
CPUThreadPoolExecutor::CPUThreadPoolExecutor(
std::pair<size_t, size_t> numThreads,
std::shared_ptr<ThreadFactory> threadFactory)
: CPUThreadPoolExecutor(
numThreads,
std::make_unique<LifoSemMPMCQueue<CPUTask>>(
CPUThreadPoolExecutor::kDefaultMaxQueueSize),
std::move(threadFactory)) {}
CPUThreadPoolExecutor::CPUThreadPoolExecutor(size_t numThreads)
: CPUThreadPoolExecutor(
numThreads,
......
......@@ -84,6 +84,10 @@ class CPUThreadPoolExecutor : public ThreadPoolExecutor {
size_t numThreads,
std::shared_ptr<ThreadFactory> threadFactory);
CPUThreadPoolExecutor(
std::pair<size_t, size_t> numThreads,
std::shared_ptr<ThreadFactory> threadFactory);
CPUThreadPoolExecutor(
size_t numThreads,
int8_t numPriorities,
......
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