summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qglobalstatic.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global/qglobalstatic.h')
-rw-r--r--src/corelib/global/qglobalstatic.h43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/corelib/global/qglobalstatic.h b/src/corelib/global/qglobalstatic.h
index 674a2aea65..034ef274fa 100644
--- a/src/corelib/global/qglobalstatic.h
+++ b/src/corelib/global/qglobalstatic.h
@@ -55,17 +55,6 @@ enum GuardValues {
};
}
-#if !QT_CONFIG(thread) || defined(Q_COMPILER_THREADSAFE_STATICS)
-// some compilers support thread-safe statics
-// The IA-64 C++ ABI requires this, so we know that all GCC versions since 3.4
-// support it. C++11 also requires this behavior.
-// Clang and Intel CC masquerade as GCC when compiling on Linux.
-//
-// Apple's libc++abi however uses a global lock for initializing local statics,
-// which will block other threads also trying to initialize a local static
-// until the constructor returns ...
-// We better avoid these kind of problems by using our own locked implementation.
-
#if defined(Q_OS_UNIX) && defined(Q_CC_INTEL)
// Work around Intel issue ID 6000058488:
// local statics inside an inline function inside an anonymous namespace are global
@@ -94,39 +83,7 @@ enum GuardValues {
} holder; \
return &holder.value; \
}
-#else
-// We don't know if this compiler supports thread-safe global statics
-// so use our own locked implementation
-QT_END_NAMESPACE
-#include <QtCore/qmutex.h>
-#include <mutex>
-QT_BEGIN_NAMESPACE
-
-#define Q_GLOBAL_STATIC_INTERNAL(ARGS) \
- Q_DECL_HIDDEN inline Type *innerFunction() \
- { \
- static Type *d; \
- static QBasicMutex mutex; \
- int x = guard.loadAcquire(); \
- if (Q_UNLIKELY(x >= QtGlobalStatic::Uninitialized)) { \
- const std::lock_guard<QBasicMutex> locker(mutex); \
- if (guard.loadRelaxed() == QtGlobalStatic::Uninitialized) { \
- d = new Type ARGS; \
- static struct Cleanup { \
- Cleanup() = default; \
- ~Cleanup() { \
- delete d; \
- guard.storeRelaxed(QtGlobalStatic::Destroyed); \
- } \
- Q_DISABLE_COPY_MOVE(Cleanup) \
- } cleanup; \
- guard.storeRelease(QtGlobalStatic::Initialized); \
- } \
- } \
- return d; \
- }
-#endif
// this class must be POD, unless the compiler supports thread-safe statics
template <typename T, T *(&innerFunction)(), QBasicAtomicInt &guard>