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