diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-06-09 14:56:00 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-06-09 16:49:41 +0200 |
commit | b55c3d4f6cc14416c64a7e796abe3d9fd996fc94 (patch) | |
tree | b4ac469cdb40ad0aeda2a4bb276bb92858c92d40 /src/qml/qml/qqmltype_p_p.h | |
parent | 9752ad5af7c7ae188250ab5b8b65c74f70d57b41 (diff) |
QQmlTypePrivate: do not abuse volatile for atomic
Instead of using volatile, use proper atomics for thread safe access.
Moreover, we don't gain anything by using bitfields here, as we have
space for 4 bools due to alignment reasons anyway. Therefore using bools
does not create any overhead.
Change-Id: I390acd935656efcb20265ddb67fa0059f3f18118
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltype_p_p.h')
-rw-r--r-- | src/qml/qml/qqmltype_p_p.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qml/qml/qqmltype_p_p.h b/src/qml/qml/qqmltype_p_p.h index c94ac8c130..8cce5b7910 100644 --- a/src/qml/qml/qqmltype_p_p.h +++ b/src/qml/qml/qqmltype_p_p.h @@ -58,6 +58,8 @@ #include <private/qqmlpropertycache_p.h> #include <private/qqmlmetatype_p.h> +#include <QAtomicInteger> + QT_BEGIN_NAMESPACE class QQmlTypePrivate : public QQmlRefCount @@ -166,10 +168,10 @@ public: const QMetaObject *baseMetaObject; int index; - mutable volatile bool isSetup:1; - mutable volatile bool isEnumFromCacheSetup:1; - mutable volatile bool isEnumFromBaseSetup:1; - mutable bool haveSuperType:1; + mutable QAtomicInteger<bool> isSetup; + mutable QAtomicInteger<bool> isEnumFromCacheSetup; + mutable QAtomicInteger<bool> isEnumFromBaseSetup; + mutable bool haveSuperType; mutable QList<QQmlProxyMetaObject::ProxyData> metaObjects; mutable QStringHash<int> enums; mutable QStringHash<int> scopedEnumIndex; // maps from enum name to index in scopedEnums |