| 1 | // Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com> |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | #ifndef QWAITCONDITION_P_H |
| 4 | #define QWAITCONDITION_P_H |
| 5 | |
| 6 | // |
| 7 | // W A R N I N G |
| 8 | // ------------- |
| 9 | // |
| 10 | // This file is not part of the Qt API. It exists for the convenience of |
| 11 | // qmutex.cpp and qmutex_unix.cpp. This header file may change from version to |
| 12 | // version without notice, or even be removed. |
| 13 | // |
| 14 | // We mean it. |
| 15 | // |
| 16 | |
| 17 | #include <QtCore/QWaitCondition> |
| 18 | #include <QtCore/QMutex> |
| 19 | #include <QtCore/QDeadlineTimer> |
| 20 | #include <QtCore/private/qglobal_p.h> |
| 21 | |
| 22 | #include <condition_variable> |
| 23 | #include <mutex> |
| 24 | |
| 25 | QT_BEGIN_NAMESPACE |
| 26 | |
| 27 | namespace QtPrivate { |
| 28 | // Ideal alignment for mutex and condition_variable: it's the hardware |
| 29 | // interference size (size of a cache line) if the types are likely to contain |
| 30 | // the actual data structures, otherwise just that of a pointer. |
| 31 | inline constexpr quintptr IdealMutexAlignment = |
| 32 | sizeof(std::mutex) > sizeof(void *) && |
| 33 | sizeof(std::condition_variable) > sizeof(void *) ? |
| 34 | 64 : alignof(void*); |
| 35 | |
| 36 | } // namespace QtPrivate |
| 37 | |
| 38 | QT_END_NAMESPACE |
| 39 | |
| 40 | #endif /* QWAITCONDITION_P_H */ |
| 41 | |