Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qatomicwait_p.h
Go to the documentation of this file.
1// Copyright (C) 2025 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 QATOMICWAIT_P_H
6#define QATOMICWAIT_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 implementation
13// detail. This header file may change from version to version without notice,
14// or even be removed.
15//
16// We mean it.
17//
18
19#include "qbasicatomic.h"
20#include <private/qglobal_p.h>
21
22QT_BEGIN_NAMESPACE
23
24namespace QtPrivate {
25enum class WakeMode { One = 1, All = -1 };
26
27#ifdef QATOMICWAIT_USE_FALLBACK
28# define Q_ATOMICWAIT_EXPORT /* being linked into the unit test */
29#else
30# define Q_ATOMICWAIT_EXPORT Q_CORE_EXPORT
31#endif
32
33Q_ATOMICWAIT_EXPORT void _q_atomicWait(const void *address, const void *old, qsizetype size) noexcept;
34Q_ATOMICWAIT_EXPORT void _q_atomicWake(void *address, WakeMode) noexcept;
35
36#undef Q_ATOMICWAIT_EXPORT
37}
38
40// C++20- & C23-like API
43{
46 QtPrivate::_q_atomicWait(atomic, &old, sizeof(T));
47 // TSAN does not support atomic_thread_fence and GCC complains (QTBUG-134415)
49#if defined(Q_CC_GNU_ONLY) && Q_CC_GNU >= 1100
51#endif
54}
55
61
67
73} // namespace QtFallbackAtomicWait
74
75namespace q20 {
76#ifdef __cpp_lib_atomic_wait
77using std::atomic_wait;
81#else
82using QtFallbackAtomicWait::atomic_wait;
83using QtFallbackAtomicWait::atomic_wait_explicit;
84using QtFallbackAtomicWait::atomic_notify_all;
85using QtFallbackAtomicWait::atomic_notify_one;
86#endif
87} // namespace QtNativeAtomicWait
88
89QT_END_NAMESPACE
90
91#endif // QATOMICWAIT_P_H
constexpr bool futexAvailable()
Definition qfutex_p.h:25
Q_ATOMICWAIT_EXPORT void _q_atomicWake(void *address, WakeMode) noexcept
Q_ATOMICWAIT_EXPORT void _q_atomicWait(const void *address, const void *old, qsizetype size) noexcept
static bool isEqual(const void *address, const void *old)
static bool isEqual(const void *address, const void *old, qsizetype size) noexcept
static void checkFutexUse()
static QAtomicWaitLocks & atomicLocks() noexcept
#define Q_ATOMICWAIT_EXPORT
std::array< Lock, LockCount > locks
Lock & lockFor(const void *ptr)