summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qfutex_p.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2021-02-22 17:11:42 -0800
committerThiago Macieira <thiago.macieira@intel.com>2023-06-18 15:45:37 -0700
commitd2368cde70062bbaa9db463d76cd135dccb55e23 (patch)
treec30701a32b5db62cc4b204b1f20e34f83bebc163 /src/corelib/thread/qfutex_p.h
parent674aa084c2d561d2377d8f8a8de1e3e7e60666f6 (diff)
Long live futexes for Darwin!
Like commit 91f6460aff0a6ab5142f16d5f4fc1f559ca1c325 which added support for Windows, this commit does the same for our final major OS. The Darwin kernel exposes a set of __ulock_{wait,wait2,wake} APIs [1], but these APIs are marked as private, so we cannot rely on them being stable, nor we can use these APIs in builds of Qt intended for the Apple App Store. By wholesale disabling the use of the APIs in App Store compliant builds, and runtime checking availability of the APIs when we do build them in, we should be safe, unless the semantics of the APIs change in ways we haven't accounted for, but that's a risk we're willing to take. Note that libc++ uses these private APIs to implement P1135R5 (the C++20 synchronization library) [2], but that use is under a "special permission" from the Darwin team, and meant only for use in the Apple vendored version of libc++ shipped with their operating systems, where they control both the kernel and the standard library. [1] https://github.com/apple-oss-distributions/xnu/blob/xnu-8792.81.2/bsd/sys/ulock.h [2] https://reviews.llvm.org/D68480. Change-Id: Ib709fc1585f647a98d54fffd16663b4965458404 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/corelib/thread/qfutex_p.h')
-rw-r--r--src/corelib/thread/qfutex_p.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/thread/qfutex_p.h b/src/corelib/thread/qfutex_p.h
index d7b91f6d2d..8ba798f920 100644
--- a/src/corelib/thread/qfutex_p.h
+++ b/src/corelib/thread/qfutex_p.h
@@ -33,7 +33,9 @@ namespace QtDummyFutex {
QT_END_NAMESPACE
-#if defined(Q_OS_FREEBSD)
+#if defined(Q_OS_DARWIN)
+# include "qfutex_mac_p.h"
+#elif defined(Q_OS_FREEBSD)
# include "qfutex_freebsd_p.h"
#elif defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
// use Linux mutexes everywhere except for LSB builds