QMetaType: make all atomic operations explicit
In one case, optimize away an unnecessary extra load. Pick-to: 6.4 Task-number: QTBUG-103834 Change-Id: Iabbf58a09627dd2fd7a40c713a878d74cb522d60 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
15422d191f
commit
f4b60a0850
@ -104,8 +104,9 @@ struct QMetaTypeCustomRegistry
|
||||
#endif
|
||||
(ti->name);
|
||||
if (auto ti2 = aliases.value(name)) {
|
||||
ti->typeId.storeRelaxed(ti2->typeId.loadRelaxed());
|
||||
return ti2->typeId;
|
||||
const auto id = ti2->typeId.loadRelaxed();
|
||||
ti->typeId.storeRelaxed(id);
|
||||
return id;
|
||||
}
|
||||
aliases[name] = ti;
|
||||
int size = registry.size();
|
||||
@ -2657,7 +2658,7 @@ static int qMetaTypeCustomType_unlocked(const char *typeName, int length)
|
||||
Q_ASSERT(!reg->lock.tryLockForWrite());
|
||||
#endif
|
||||
if (auto ti = reg->aliases.value(QByteArray::fromRawData(typeName, length), nullptr)) {
|
||||
return ti->typeId;
|
||||
return ti->typeId.loadRelaxed();
|
||||
}
|
||||
}
|
||||
return QMetaType::UnknownType;
|
||||
|
Loading…
x
Reference in New Issue
Block a user