Pass the thread pool into BlockSizeManager

This was overlooked when enabling setting a custom thread pool
for various concurrent methods.

Fixes: QTBUG-53465
Change-Id: I8b0a0086e46639639051fe99cf52d049f7bb3bb2
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
This commit is contained in:
Jarek Kobus 2020-05-28 13:26:39 +02:00
parent b6a2962a52
commit 9aea74f2c6
2 changed files with 4 additions and 4 deletions

View File

@ -102,8 +102,8 @@ namespace QtConcurrent {
/*! \internal /*! \internal
*/ */
BlockSizeManager::BlockSizeManager(int iterationCount) BlockSizeManager::BlockSizeManager(QThreadPool *pool, int iterationCount)
: maxBlockSize(iterationCount / (QThreadPool::globalInstance()->maxThreadCount() * 2)), : maxBlockSize(iterationCount / (pool->maxThreadCount() * 2)),
beforeUser(0), afterUser(0), beforeUser(0), afterUser(0),
m_blockSize(1) m_blockSize(1)
{ } { }

View File

@ -67,7 +67,7 @@ namespace QtConcurrent {
class Q_CONCURRENT_EXPORT BlockSizeManager class Q_CONCURRENT_EXPORT BlockSizeManager
{ {
public: public:
explicit BlockSizeManager(int iterationCount); explicit BlockSizeManager(QThreadPool *pool, int iterationCount);
void timeBeforeUser(); void timeBeforeUser();
void timeAfterUser(); void timeAfterUser();
@ -198,7 +198,7 @@ public:
ThreadFunctionResult forThreadFunction() ThreadFunctionResult forThreadFunction()
{ {
BlockSizeManager blockSizeManager(iterationCount); BlockSizeManager blockSizeManager(ThreadEngineBase::threadPool, iterationCount);
ResultReporter<T> resultReporter(this); ResultReporter<T> resultReporter(this);
for(;;) { for(;;) {