diff options
author | Thiago Macieira <[email protected]> | 2025-06-16 08:04:53 -0700 |
---|---|---|
committer | Thiago Macieira <[email protected]> | 2025-07-04 10:35:15 -0700 |
commit | 7bbcb952047f928ac44917aa845752e835f3aea2 (patch) | |
tree | 19941d421e525347f9e1a7cde669e0aa9f6a9037 /src | |
parent | e192599d636f86bb83f6219b37542e7ee9e61d74 (diff) |
This saves some code emission and the 2kB of .bss space for the locks.
Change-Id: Icf6a9c0091b86d6e223afffdb4acede2c2f930f5
Reviewed-by: MÃ¥rten Nordheim <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/thread/qatomicwait.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/corelib/thread/qatomicwait.cpp b/src/corelib/thread/qatomicwait.cpp index 3d70333ca7b..25ca771643b 100644 --- a/src/corelib/thread/qatomicwait.cpp +++ b/src/corelib/thread/qatomicwait.cpp @@ -4,6 +4,7 @@ #include "qatomicwait_p.h" #include <qendian.h> +#include "qfutex_p.h" #include "qwaitcondition_p.h" #include <array> @@ -96,8 +97,21 @@ struct QAtomicWaitLocks }; } // unnamed namespace +static inline void checkFutexUse() +{ +#if !defined(QATOMICWAIT_USE_FALLBACK) + if (QtFutex::futexAvailable()) { + // This will disable the code and data on systems where futexes are + // always available (currently: FreeBSD, Linux, Windows). + qFatal("Implementation should have used futex!"); + } +#endif +} + static QAtomicWaitLocks &atomicLocks() noexcept { + checkFutexUse(); + static QAtomicWaitLocks global {}; return global; } |