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>
This commit is contained in:
parent
c563e5b3c7
commit
8b34296e6a
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user