summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/thread')
-rw-r--r--src/corelib/thread/qbasicatomic.h3
-rw-r--r--src/corelib/thread/qgenericatomic.h16
2 files changed, 4 insertions, 15 deletions
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h
index 9fa12ba811..f75a24ae10 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qbasicatomic.h
@@ -114,7 +114,8 @@ class QBasicAtomicInteger
public:
typedef QAtomicOps<T> Ops;
// static check that this is a valid integer
- Q_STATIC_ASSERT_X(QAtomicIntegerTraits<T>::IsInteger, "Template parameter is not a supported integer on this platform");
+ Q_STATIC_ASSERT_X(QTypeInfo<T>::isIntegral, "template parameter is not an integral type");
+ Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform");
typename Ops::Type _q_value;
diff --git a/src/corelib/thread/qgenericatomic.h b/src/corelib/thread/qgenericatomic.h
index bbdc57ca50..eacde411b9 100644
--- a/src/corelib/thread/qgenericatomic.h
+++ b/src/corelib/thread/qgenericatomic.h
@@ -60,20 +60,8 @@ QT_END_NAMESPACE
#define always_inline
#endif
-template<typename T> struct QAtomicIntegerTraits { enum { IsInteger = 0 }; };
-
-// these integers are always supported, on all platforms
-// - int, unsigned int and char32_t are 32-bit wide
-// - long and unsigned long might be 64-bit wide on 64-bit platforms,
-// but 64-bit integer support is required anyway
-template<> struct QAtomicIntegerTraits<int> { enum { IsInteger = 1 }; };
-template<> struct QAtomicIntegerTraits<unsigned int> { enum { IsInteger = 1 }; };
-template<> struct QAtomicIntegerTraits<long> { enum { IsInteger = 1 }; };
-template<> struct QAtomicIntegerTraits<unsigned long> { enum { IsInteger = 1 }; };
-#ifdef Q_COMPILER_UNICODE_STRINGS
-template<> struct QAtomicIntegerTraits<char32_t>
-{ enum { IsInteger = sizeof(char32_t) == sizeof(int) ? 1 : -1 }; };
-#endif
+template<int> struct QAtomicOpsSupport { enum { IsSupported = 0 }; };
+template<> struct QAtomicOpsSupport<4> { enum { IsSupported = 1 }; };
template <typename T> struct QAtomicAdditiveType
{