Implemented runtime thread count resizing for execution pool#1
Implemented runtime thread count resizing for execution pool#1SerhiiHrabarskiy wants to merge 2 commits intomasterfrom
Conversation
df25a59 to
3d3b6af
Compare
| { | ||
| public: | ||
| MOCK_CONST_METHOD1(createWorker, std::unique_ptr<execq::impl::IThreadWorker>(execq::impl::ITaskProvider& provider)); | ||
| MOCK_CONST_METHOD2(createWorker, std::unique_ptr<execq::impl::IThreadWorker>(execq::impl::ITaskProvider& provider, execq::impl::ThreadStopCb cb)); |
There was a problem hiding this comment.
Can we use modern mock style ?
like MOCK_METHOD(bool, name, (), (const, override));
|
|
||
| namespace | ||
| { | ||
| static constexpr uint64_t packThreadsCount(uint32_t target, uint32_t current) |
There was a problem hiding this comment.
'packThreadsCount' is a static definition in anonymous namespace; static is redundant here
| { | ||
| return (uint64_t(target) << 32) | uint64_t(current); | ||
| } | ||
| static constexpr uint32_t unpackTarget(uint64_t threadCount) |
There was a problem hiding this comment.
is a static definition in anonymous namespace; static is redundant here
| { | ||
| return uint32_t(threadCount >> 32); | ||
| } | ||
| static constexpr uint32_t unpackCurrent(uint64_t threadCount) |
There was a problem hiding this comment.
is a static definition in anonymous namespace; static is redundant here
| } | ||
| static constexpr uint32_t unpackCurrent(uint64_t threadCount) | ||
| { | ||
| return uint32_t(threadCount & 0xFFFFFFFFu); |
There was a problem hiding this comment.
Integer literal has suffix 'u', which is not uppercase
https://clang.llvm.org/extra/clang-tidy/checks/readability/uppercase-literal-suffix.html
| { | ||
| public: | ||
| virtual std::unique_ptr<IThreadWorker> createWorker(ITaskProvider& provider) const final | ||
| virtual std::unique_ptr<IThreadWorker> createWorker(ITaskProvider& provider, ThreadStopCb cb = nullptr) const final |
There was a problem hiding this comment.
'virtual' is redundant since the function is already declared 'final'
| virtual std::unique_ptr<IThreadWorker> createWorker(ITaskProvider& provider, ThreadStopCb cb = nullptr) const final | ||
| { | ||
| return std::unique_ptr<IThreadWorker>(new ThreadWorker(provider)); | ||
| return std::unique_ptr<IThreadWorker>(new ThreadWorker(provider, cb)); |
There was a problem hiding this comment.
std::make_uniquestd::thread
| virtual ~ThreadWorker(); | ||
|
|
||
| virtual bool notifyWorker() final; | ||
| virtual bool finished() final; |
There was a problem hiding this comment.
'virtual' is redundant since the function is already declared 'final'
| virtual void notifyAllWorkers() final; | ||
|
|
||
|
|
||
| virtual void setThreadCount(uint32_t threadCount) final; |
There was a problem hiding this comment.
'virtual' is redundant since the function is already declared 'final'
| namespace details | ||
| { | ||
| bool NotifyWorkers(const std::vector<std::unique_ptr<IThreadWorker>>& workers, const bool single); | ||
| bool NotifyWorkers(const ThreadWorkers& workers, const bool single); |
No description provided.