diff options
-rw-r--r-- | src/core/jobs/qthreadpooler.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/jobs/qthreadpooler.cpp b/src/core/jobs/qthreadpooler.cpp index 94d5b29c2..b5d7ba10b 100644 --- a/src/core/jobs/qthreadpooler.cpp +++ b/src/core/jobs/qthreadpooler.cpp @@ -119,6 +119,8 @@ QFuture<void> QThreadPooler::mapDependables(QVector<RunnableInterface *> &taskQu QFuture<void> QThreadPooler::future() { + const QMutexLocker locker(m_mutex); + if (!m_futureInterface) return QFuture<void>(); else @@ -127,6 +129,8 @@ QFuture<void> QThreadPooler::future() void QThreadPooler::acquire(int add) { + // The caller have to set the mutex + forever { int localCount = m_taskCount.load(); if (m_taskCount.testAndSetOrdered(localCount, localCount + add)) @@ -136,6 +140,8 @@ void QThreadPooler::acquire(int add) void QThreadPooler::release() { + // The caller have to set the mutex + forever { int localCount = m_taskCount.load(); @@ -149,6 +155,8 @@ void QThreadPooler::release() int QThreadPooler::currentCount() { + // The caller have to set the mutex + return m_taskCount.load(); } |