summaryrefslogtreecommitdiffstats
path: root/src/core/jobs
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-04-26 22:39:40 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-04-28 05:07:20 +0000
commit59724da7453834825aab465a033a349b9624eec5 (patch)
treedd1261b5d7d76eddc375122202ea71d4fd9b9a45 /src/core/jobs
parent290c9d1088ac8c2c986ff1461e994364c6c8f3b0 (diff)
QThreadPooler: minimize critical section
The localStorageMutex only needs to be held when appending to localStorages here, because the heap allocation is a purely local act and setting the object on QThreadStorage is thead-safe. Change-Id: I01f6f12a22e19ec0d53d5e039779c6917dbbda05 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/core/jobs')
-rw-r--r--src/core/jobs/qthreadpooler.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/jobs/qthreadpooler.cpp b/src/core/jobs/qthreadpooler.cpp
index 8d64b3f20..7efac01a8 100644
--- a/src/core/jobs/qthreadpooler.cpp
+++ b/src/core/jobs/qthreadpooler.cpp
@@ -185,9 +185,9 @@ QMutex localStoragesMutex;
void QThreadPooler::addJobLogStatsEntry(JobRunStats &stats)
{
if (!jobStatsCached.hasLocalData()) {
- QMutexLocker lock(&localStoragesMutex);
auto jobVector = new JobRunStatsList;
jobStatsCached.setLocalData(jobVector);
+ QMutexLocker lock(&localStoragesMutex);
localStorages.push_back(jobVector);
}
jobStatsCached.localData()->push_back(stats);