diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-07-11 17:17:13 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-07-11 17:17:51 +0200 |
commit | 4dac45c9ee59ff6586d90d423654da91523ab679 (patch) | |
tree | cd4a4adf2cbc9e77bf86d2d11e71ec66afdf3be4 /src/concurrent | |
parent | 078cd61751aeaa310d35a3d596a21a36004a1a0f (diff) | |
parent | f44850b5c3464cdda0ee9b1ee858d95f3ffaa3e2 (diff) |
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I715b1d743d5f11560e7b3fbeb8fd64a5e5ddb277
Diffstat (limited to 'src/concurrent')
-rw-r--r-- | src/concurrent/doc/qtconcurrent.qdocconf | 1 | ||||
-rw-r--r-- | src/concurrent/qtconcurrentiteratekernel.h | 8 | ||||
-rw-r--r-- | src/concurrent/qtconcurrentrun.cpp | 16 | ||||
-rw-r--r-- | src/concurrent/qtconcurrentthreadengine.cpp | 10 |
4 files changed, 18 insertions, 17 deletions
diff --git a/src/concurrent/doc/qtconcurrent.qdocconf b/src/concurrent/doc/qtconcurrent.qdocconf index 356d602a7c..610dca2a7e 100644 --- a/src/concurrent/doc/qtconcurrent.qdocconf +++ b/src/concurrent/doc/qtconcurrent.qdocconf @@ -1,4 +1,5 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) +include($QT_INSTALL_DOCS/config/exampleurl-qtbase.qdocconf) project = QtConcurrent description = Qt Concurrent Reference Documentation diff --git a/src/concurrent/qtconcurrentiteratekernel.h b/src/concurrent/qtconcurrentiteratekernel.h index 89fd3d2592..3095c9ff52 100644 --- a/src/concurrent/qtconcurrentiteratekernel.h +++ b/src/concurrent/qtconcurrentiteratekernel.h @@ -206,9 +206,9 @@ public: bool shouldStartThread() override { if (forIteration) - return (currentIndex.load() < iterationCount) && !this->shouldThrottleThread(); + return (currentIndex.loadRelaxed() < iterationCount) && !this->shouldThrottleThread(); else // whileIteration - return (iteratorThreads.load() == 0); + return (iteratorThreads.loadRelaxed() == 0); } ThreadFunctionResult threadFunction() override @@ -230,7 +230,7 @@ public: const int currentBlockSize = blockSizeManager.blockSize(); - if (currentIndex.load() >= iterationCount) + if (currentIndex.loadRelaxed() >= iterationCount) break; // Atomically reserve a block of iterationCount for this thread. @@ -261,7 +261,7 @@ public: // Report progress if progress reporting enabled. if (progressReportingEnabled) { completed.fetchAndAddAcquire(finalBlockSize); - this->setProgressValue(this->completed.load()); + this->setProgressValue(this->completed.loadRelaxed()); } if (this->shouldThrottleThread()) diff --git a/src/concurrent/qtconcurrentrun.cpp b/src/concurrent/qtconcurrentrun.cpp index bbd1f5ec62..d9867e1f1a 100644 --- a/src/concurrent/qtconcurrentrun.cpp +++ b/src/concurrent/qtconcurrentrun.cpp @@ -138,10 +138,10 @@ T is the same type as the return value of \a function. Non-void return values can be accessed via the QFuture::result() function. - Note that the QFuture returned by QtConcurrent::run() does not support - canceling, pausing, or progress reporting. The QFuture returned can only - be used to query for the running/finished status and the return value of - the function. + \note The QFuture returned can only be used to query for the + running/finished status and the return value of the function. In particular, + canceling or pausing can be issued only if the computations behind the future + has not been started. \sa {Concurrent Run} */ @@ -157,10 +157,10 @@ T is the same type as the return value of \a function. Non-void return values can be accessed via the QFuture::result() function. - Note that the QFuture returned by QtConcurrent::run() does not support - canceling, pausing, or progress reporting. The QFuture returned can only - be used to query for the running/finished status and the return value of - the function. + \note The QFuture returned can only be used to query for the + running/finished status and the return value of the function. In particular, + canceling or pausing can be issued only if the computations behind the future + has not been started. \sa {Concurrent Run} */ diff --git a/src/concurrent/qtconcurrentthreadengine.cpp b/src/concurrent/qtconcurrentthreadengine.cpp index 968720cbbe..7f91a2ba68 100644 --- a/src/concurrent/qtconcurrentthreadengine.cpp +++ b/src/concurrent/qtconcurrentthreadengine.cpp @@ -91,7 +91,7 @@ ThreadEngineBarrier::ThreadEngineBarrier() void ThreadEngineBarrier::acquire() { forever { - int localCount = count.load(); + int localCount = count.loadRelaxed(); if (localCount < 0) { if (count.testAndSetOrdered(localCount, localCount -1)) return; @@ -105,7 +105,7 @@ void ThreadEngineBarrier::acquire() int ThreadEngineBarrier::release() { forever { - int localCount = count.load(); + int localCount = count.loadRelaxed(); if (localCount == -1) { if (count.testAndSetOrdered(-1, 0)) { semaphore.release(); @@ -125,7 +125,7 @@ int ThreadEngineBarrier::release() void ThreadEngineBarrier::wait() { forever { - int localCount = count.load(); + int localCount = count.loadRelaxed(); if (localCount == 0) return; @@ -139,7 +139,7 @@ void ThreadEngineBarrier::wait() int ThreadEngineBarrier::currentCount() { - return count.load(); + return count.loadRelaxed(); } // releases a thread, unless this is the last thread. @@ -147,7 +147,7 @@ int ThreadEngineBarrier::currentCount() bool ThreadEngineBarrier::releaseUnlessLast() { forever { - int localCount = count.load(); + int localCount = count.loadRelaxed(); if (qAbs(localCount) == 1) { return false; } else if (localCount < 0) { |