Commit bc1365d3 authored by Constantin Dolghier's avatar Constantin Dolghier Committed by Facebook GitHub Bot

Move isWaitForAll_ from ThreadPoolExecutor to IOThreadPoolExecutor

Summary:
I randomly ran into this while working on something else: ThreadPoolExecutor has a field `isWaitForAll_` which:
* is only used in its subclass, `IOThreadPoolExecutor`
* has a comment referencing evbs, which ThreadPoolExecutor doesn't have relationship to but the subclass does.

Looks like this is an artefact of some old refactoring

Reviewed By: yfeldblum

Differential Revision: D31117228

fbshipit-source-id: ea7d1753a0d75ab8911cec68f3b6fb8c1f07c569
parent 5c748c42
......@@ -86,8 +86,8 @@ IOThreadPoolExecutor::IOThreadPoolExecutor(
: ThreadPoolExecutor(
numThreads,
FLAGS_dynamic_iothreadpoolexecutor ? 0 : numThreads,
std::move(threadFactory),
waitForAll),
std::move(threadFactory)),
isWaitForAll_(waitForAll),
nextThread_(0),
eventBaseManager_(ebm) {
setNumThreads(numThreads);
......@@ -100,8 +100,8 @@ IOThreadPoolExecutor::IOThreadPoolExecutor(
std::shared_ptr<ThreadFactory> threadFactory,
EventBaseManager* ebm,
bool waitForAll)
: ThreadPoolExecutor(
maxThreads, minThreads, std::move(threadFactory), waitForAll),
: ThreadPoolExecutor(maxThreads, minThreads, std::move(threadFactory)),
isWaitForAll_(waitForAll),
nextThread_(0),
eventBaseManager_(ebm) {
setNumThreads(maxThreads);
......
......@@ -102,6 +102,7 @@ class IOThreadPoolExecutor : public ThreadPoolExecutor, public IOExecutor {
void stopThreads(size_t n) override;
size_t getPendingTaskCountImpl() const override final;
const bool isWaitForAll_; // whether to wait till event base loop exits
std::atomic<size_t> nextThread_;
folly::ThreadLocal<std::shared_ptr<IOThread>> thisThread_;
folly::EventBaseManager* eventBaseManager_;
......
......@@ -48,10 +48,8 @@ DEFINE_int64(
ThreadPoolExecutor::ThreadPoolExecutor(
size_t /* maxThreads */,
size_t minThreads,
std::shared_ptr<ThreadFactory> threadFactory,
bool isWaitForAll)
std::shared_ptr<ThreadFactory> threadFactory)
: threadFactory_(std::move(threadFactory)),
isWaitForAll_(isWaitForAll),
taskStatsCallbacks_(std::make_shared<TaskStatsCallbackRegistry>()),
threadPoolHook_("folly::ThreadPoolExecutor"),
minThreads_(minThreads),
......
......@@ -69,8 +69,7 @@ class ThreadPoolExecutor : public DefaultKeepAliveExecutor {
explicit ThreadPoolExecutor(
size_t maxThreads,
size_t minThreads,
std::shared_ptr<ThreadFactory> threadFactory,
bool isWaitForAll = false);
std::shared_ptr<ThreadFactory> threadFactory);
~ThreadPoolExecutor() override;
......@@ -287,7 +286,6 @@ class ThreadPoolExecutor : public DefaultKeepAliveExecutor {
std::shared_ptr<ThreadFactory> threadFactory_;
std::string namePrefix_;
const bool isWaitForAll_; // whether to wait till event base loop exits
ThreadList threadList_;
SharedMutex threadListLock_;
......
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