| 1 | // Copyright (C) 2017 Intel Corporation. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QFUTEX_P_H |
| 5 | #define QFUTEX_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <qdeadlinetimer.h> |
| 19 | #include <private/qglobal_p.h> |
| 20 | |
| 21 | QT_BEGIN_NAMESPACE |
| 22 | |
| 23 | namespace QtDummyFutex { |
| 24 | constexpr inline bool futexAvailable() { return false; } |
| 25 | template <typename Atomic> |
| 26 | inline bool futexWait(Atomic &, typename Atomic::Type, QDeadlineTimer = {}) |
| 27 | { Q_UNREACHABLE_RETURN(false); } |
| 28 | template <typename Atomic> inline void futexWakeOne(Atomic &) |
| 29 | { Q_UNREACHABLE(); } |
| 30 | template <typename Atomic> inline void futexWakeAll(Atomic &) |
| 31 | { Q_UNREACHABLE(); } |
| 32 | } |
| 33 | |
| 34 | QT_END_NAMESPACE |
| 35 | |
| 36 | #if defined(Q_OS_DARWIN) |
| 37 | # include "qfutex_mac_p.h" |
| 38 | #elif defined(Q_OS_FREEBSD) |
| 39 | # include "qfutex_freebsd_p.h" |
| 40 | #elif defined(Q_OS_LINUX) && !defined(QT_LINUXBASE) |
| 41 | // use Linux mutexes everywhere except for LSB builds |
| 42 | # include "qfutex_linux_p.h" |
| 43 | #elif defined(Q_OS_WIN) |
| 44 | # include "qfutex_win_p.h" |
| 45 | #else |
| 46 | QT_BEGIN_NAMESPACE |
| 47 | namespace QtFutex = QtDummyFutex; |
| 48 | QT_END_NAMESPACE |
| 49 | #endif |
| 50 | |
| 51 | #endif // QFUTEX_P_H |
| 52 | |