Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qfutex_win_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 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_WIN_P_H
5#define QFUTEX_WIN_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 <private/qglobal_p.h>
19#include <qdeadlinetimer.h>
20#include <qtsan_impl.h>
21
22#include <qt_windows.h>
23
24#define QT_ALWAYS_USE_FUTEX
25
27
28namespace QtWindowsFutex {
29constexpr inline bool futexAvailable() { return true; }
30
31template <typename Atomic>
32inline void futexWait(Atomic &futex, typename Atomic::Type expectedValue)
33{
35 WaitOnAddress(&futex, &expectedValue, sizeof(expectedValue), INFINITE);
37}
38template <typename Atomic>
39inline bool futexWait(Atomic &futex, typename Atomic::Type expectedValue, QDeadlineTimer deadline)
40{
41 using namespace std::chrono;
42 BOOL r = WaitOnAddress(&futex, &expectedValue, sizeof(expectedValue), DWORD(deadline.remainingTime()));
43 return r || GetLastError() != ERROR_TIMEOUT;
44}
45template <typename Atomic> inline void futexWakeAll(Atomic &futex)
46{
47 WakeByAddressAll(&futex);
48}
49template <typename Atomic> inline void futexWakeOne(Atomic &futex)
50{
51 WakeByAddressSingle(&futex);
52}
53} // namespace QtWindowsFutex
54namespace QtFutex = QtWindowsFutex;
55
57
58#endif // QFUTEX_WIN_P_H
\inmodule QtCore
qint64 remainingTime() const noexcept
Returns the remaining time in this QDeadlineTimer object in milliseconds.
Combined button and popup list for selecting options.
void futexRelease(void *, void *=nullptr)
Definition qtsan_impl.h:63
void futexAcquire(void *, void *=nullptr)
Definition qtsan_impl.h:62
void futexWakeOne(Atomic &futex)
void futexWait(Atomic &futex, typename Atomic::Type expectedValue)
void futexWakeAll(Atomic &futex)
constexpr bool futexAvailable()
GLboolean r
[2]
QDeadlineTimer deadline(30s)