Optimize atomics in QObject::moveToThread() [1/2]: relax a pointer load
We don't need an acquire fence for checking a pointer for nullness, and we're not dereferencing the pointer later, so use a relaxed load there. Pick-to: 6.3 Change-Id: Id84e6fc50100f1bf6a4e33f89424f8b1cbb250cd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
5dc724d98d
commit
adb4a3beb7
@ -1818,7 +1818,7 @@ void QObject::moveToThread(QThread *targetThread)
|
||||
QThreadData *currentData = QThreadData::current();
|
||||
QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : nullptr;
|
||||
QThreadData *thisThreadData = d->threadData.loadAcquire();
|
||||
if (!thisThreadData->thread.loadAcquire() && currentData == targetData) {
|
||||
if (!thisThreadData->thread.loadRelaxed() && currentData == targetData) {
|
||||
// one exception to the rule: we allow moving objects with no thread affinity to the current thread
|
||||
currentData = d->threadData;
|
||||
} else if (thisThreadData != currentData) {
|
||||
|
Loading…
Reference in New Issue
Block a user