summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthread.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-07-13 09:50:16 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-07-16 10:37:30 +0000
commit8b34296e6a86ce5ad9dba6ac54c84a64cec09b96 (patch)
tree9e477d921b50de5eb1e498409ce9006ec087018e /src/corelib/thread/qthread.cpp
parentc563e5b3c7f483684da0759a28393b2140541771 (diff)
Fix more implicit QAtomic<T> <-> T conversions
These were hidden in !QT_CONFIG(thread) code. The irony! This patch does not change the semantics of the operations. It just makes the implicit operations explicit. Any fixes or optimizations are left for follow-up patches, if any. Change-Id: I014eb71745532dae2efe7963aa87321f61b1bd7a Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/thread/qthread.cpp')
-rw-r--r--src/corelib/thread/qthread.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 280c785049..9fd1dd059d 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -851,7 +851,7 @@ Qt::HANDLE QThread::currentThreadId() noexcept
QThread *QThread::currentThread()
{
- return QThreadData::current()->thread;
+ return QThreadData::current()->thread.loadAcquire();
}
int QThread::idealThreadCount() noexcept
@@ -883,11 +883,11 @@ QThreadData *QThreadData::current(bool createIfNecessary)
if (!data && createIfNecessary) {
data = new QThreadData;
data->thread = new QAdoptedThread(data);
- data->threadId.storeRelaxed(Qt::HANDLE(data->thread));
+ data->threadId.storeRelaxed(Qt::HANDLE(data->thread.loadAcquire()));
data->deref();
data->isAdopted = true;
- if (!QCoreApplicationPrivate::theMainThread)
- QCoreApplicationPrivate::theMainThread = data->thread.loadRelaxed();
+ if (!QCoreApplicationPrivate::theMainThread.loadAcquire())
+ QCoreApplicationPrivate::theMainThread.storeRelease(data->thread.loadRelaxed());
}
return data;
}