Commit ca5024ee authored by Dan Melnic's avatar Dan Melnic Committed by Facebook GitHub Bot

Add the ability to specify the min number of threads without changing a gflag

Summary: Add the ability to specify the min number of threads without changing a gflag

Reviewed By: stuclar

Differential Revision: D23557854

fbshipit-source-id: d4394e979c123e7f312816b1dec2849d46b0de9a
parent 18fd6fc8
...@@ -94,6 +94,23 @@ IOThreadPoolExecutor::IOThreadPoolExecutor( ...@@ -94,6 +94,23 @@ IOThreadPoolExecutor::IOThreadPoolExecutor(
registerThreadPoolExecutor(this); registerThreadPoolExecutor(this);
} }
IOThreadPoolExecutor::IOThreadPoolExecutor(
size_t maxThreads,
size_t minThreads,
std::shared_ptr<ThreadFactory> threadFactory,
EventBaseManager* ebm,
bool waitForAll)
: ThreadPoolExecutor(
maxThreads,
minThreads,
std::move(threadFactory),
waitForAll),
nextThread_(0),
eventBaseManager_(ebm) {
setNumThreads(maxThreads);
registerThreadPoolExecutor(this);
}
IOThreadPoolExecutor::~IOThreadPoolExecutor() { IOThreadPoolExecutor::~IOThreadPoolExecutor() {
deregisterThreadPoolExecutor(this); deregisterThreadPoolExecutor(this);
stop(); stop();
......
...@@ -64,6 +64,14 @@ class IOThreadPoolExecutor : public ThreadPoolExecutor, public IOExecutor { ...@@ -64,6 +64,14 @@ class IOThreadPoolExecutor : public ThreadPoolExecutor, public IOExecutor {
folly::EventBaseManager* ebm = folly::EventBaseManager::get(), folly::EventBaseManager* ebm = folly::EventBaseManager::get(),
bool waitForAll = false); bool waitForAll = false);
IOThreadPoolExecutor(
size_t maxThreads,
size_t minThreads,
std::shared_ptr<ThreadFactory> threadFactory =
std::make_shared<NamedThreadFactory>("IOThreadPool"),
folly::EventBaseManager* ebm = folly::EventBaseManager::get(),
bool waitForAll = false);
~IOThreadPoolExecutor() override; ~IOThreadPoolExecutor() override;
void add(Func func) override; void add(Func func) override;
......
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