summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthreadpool.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-01-28 12:36:59 +0000
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-01-29 10:55:42 +0000
commitf2c3b52c6c513ebba9dc0db69efe8bdbf6be8334 (patch)
treeba924e5dfb28339e517dc1868bfe5ecf228d261d /src/corelib/thread/qthreadpool.cpp
parentbd520ccc3c5742e7af61fef66bab96575b7b67ac (diff)
Revert "Port QThreadPool to the new property system"
This reverts commit 8f8405e04642b98663d4752d4ae76c304ae33b01. Reason for revert: Appears not entirely thread-safe and caused QTBUG-90705 Change-Id: I390c0b1a555a18e6a095b52010371d017071e26b Fixes: QTBUG-90705 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'src/corelib/thread/qthreadpool.cpp')
-rw-r--r--src/corelib/thread/qthreadpool.cpp37
1 files changed, 11 insertions, 26 deletions
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp
index b1f538fa43..6d258af9df 100644
--- a/src/corelib/thread/qthreadpool.cpp
+++ b/src/corelib/thread/qthreadpool.cpp
@@ -163,7 +163,7 @@ void QThreadPoolThread::registerThreadInactive()
/*
\internal
*/
-QThreadPoolPrivate::QThreadPoolPrivate()
+QThreadPoolPrivate:: QThreadPoolPrivate()
{ }
bool QThreadPoolPrivate::tryStart(QRunnable *task)
@@ -223,8 +223,10 @@ void QThreadPoolPrivate::enqueueTask(QRunnable *runnable, int priority)
int QThreadPoolPrivate::activeThreadCount() const
{
- return int(allThreads.count() - expiredThreads.count() - waitingThreads.count()
- + reservedThreads);
+ return (allThreads.count()
+ - expiredThreads.count()
+ - waitingThreads.count()
+ + reservedThreads);
}
void QThreadPoolPrivate::tryToStartMoreThreads()
@@ -603,15 +605,11 @@ int QThreadPool::expiryTimeout() const
void QThreadPool::setExpiryTimeout(int expiryTimeout)
{
Q_D(QThreadPool);
+ if (d->expiryTimeout == expiryTimeout)
+ return;
d->expiryTimeout = expiryTimeout;
}
-QBindable<int> QThreadPool::bindableExpiryTimeout()
-{
- Q_D(QThreadPool);
- return &d->expiryTimeout;
-}
-
/*! \property QThreadPool::maxThreadCount
\brief the maximum number of threads used by the thread pool.
@@ -633,18 +631,11 @@ void QThreadPool::setMaxThreadCount(int maxThreadCount)
Q_D(QThreadPool);
QMutexLocker locker(&d->mutex);
- const auto maxThreadCountChanged = maxThreadCount != d->maxThreadCount;
- // Rewrite the value in any case, to make sure the binding is cleared.
- d->maxThreadCount = maxThreadCount;
-
- if (maxThreadCountChanged)
- d->tryToStartMoreThreads();
-}
+ if (maxThreadCount == d->maxThreadCount)
+ return;
-QBindable<int> QThreadPool::bindableMaxThreadCount()
-{
- Q_D(QThreadPool);
- return &d->maxThreadCount;
+ d->maxThreadCount = maxThreadCount;
+ d->tryToStartMoreThreads();
}
/*! \property QThreadPool::activeThreadCount
@@ -707,12 +698,6 @@ uint QThreadPool::stackSize() const
return d->stackSize;
}
-QBindable<uint> QThreadPool::bindableStackSize()
-{
- Q_D(QThreadPool);
- return &d->stackSize;
-}
-
/*!
Releases a thread previously reserved by a call to reserveThread().