From 8b34296e6a86ce5ad9dba6ac54c84a64cec09b96 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 13 Jul 2019 09:50:16 +0200 Subject: Fix more implicit QAtomic <-> T conversions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/corelib/thread/qthread.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib/thread') 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; } -- cgit v1.2.3