diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-11 16:16:29 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-11 16:23:19 +0200 |
commit | f4b4c4f79b629498f3cddbbc10df8c1b4d6020d9 (patch) | |
tree | 4119707660438ff58bd51f9cbe0f9e2a33f4b806 /src/concurrent | |
parent | 9bd6cec74dbbc5aece55dc0c8808494db29b9963 (diff) | |
parent | 93f2f33a49f6c96a4f94f344edf03164ed944d02 (diff) |
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I3a1d7673c3c20019ab12a2ea0a60f1619920a34c
Diffstat (limited to 'src/concurrent')
-rw-r--r-- | src/concurrent/qtconcurrentreducekernel.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/concurrent/qtconcurrentreducekernel.h b/src/concurrent/qtconcurrentreducekernel.h index 0fbc40e02e..8f9a938952 100644 --- a/src/concurrent/qtconcurrentreducekernel.h +++ b/src/concurrent/qtconcurrentreducekernel.h @@ -52,6 +52,8 @@ #include <QtCore/qthreadpool.h> #include <QtCore/qvector.h> +#include <mutex> + QT_BEGIN_NAMESPACE @@ -147,7 +149,7 @@ public: ReduceResultType &r, const IntermediateResults<T> &result) { - QMutexLocker locker(&mutex); + std::unique_lock<QMutex> locker(mutex); if (!canReduce(result.begin)) { ++resultsMapSize; resultsMap.insert(result.begin, result); @@ -161,7 +163,7 @@ public: // reduce this result locker.unlock(); reduceResult(reduce, r, result); - locker.relock(); + locker.lock(); // reduce all stored results as well while (!resultsMap.isEmpty()) { @@ -170,7 +172,7 @@ public: locker.unlock(); reduceResults(reduce, r, resultsMapCopy); - locker.relock(); + locker.lock(); resultsMapSize -= resultsMapCopy.size(); } @@ -180,7 +182,7 @@ public: // reduce this result locker.unlock(); reduceResult(reduce, r, result); - locker.relock(); + locker.lock(); // OrderedReduce progress += result.end - result.begin; @@ -193,7 +195,7 @@ public: locker.unlock(); reduceResult(reduce, r, it.value()); - locker.relock(); + locker.lock(); --resultsMapSize; progress += it.value().end - it.value().begin; |