QMetaType: make all atomic operations explicit
In one case, optimize away an unnecessary extra load. Task-number: QTBUG-103834 Change-Id: Iabbf58a09627dd2fd7a40c713a878d74cb522d60 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit f4b60a0850ea9f67338bfd22d0847f0f0db72255) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
3ddcb2b33e
commit
21c6fdf6a1
@ -87,8 +87,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();
|
||||
@ -2555,7 +2556,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