1 | // Copyright (C) 2024 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | // |
5 | // W A R N I N G |
6 | // ------------- |
7 | // |
8 | // This file is not part of the Qt API. It exists purely as an |
9 | // implementation detail. This header file may change from version to |
10 | // version without notice, or even be removed. |
11 | // |
12 | // We mean it. |
13 | // |
14 | |
15 | #ifndef QAUTORESETEVENT_PIPE_P_H |
16 | #define QAUTORESETEVENT_PIPE_P_H |
17 | |
18 | #include <QtCore/qsocketnotifier.h> |
19 | #include <QtMultimedia/qtmultimediaexports.h> |
20 | #include <atomic> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | namespace QtPrivate { |
25 | |
26 | class Q_MULTIMEDIA_EXPORT QAutoResetEventPipe : public QObject |
27 | { |
28 | Q_OBJECT |
29 | |
30 | public: |
31 | explicit QAutoResetEventPipe(QObject *parent = nullptr); |
32 | |
33 | ~QAutoResetEventPipe(); |
34 | |
35 | bool isValid() const { return m_fdProducer != -1; } |
36 | |
37 | void set(); |
38 | |
39 | Q_SIGNALS: |
40 | void activated(); |
41 | |
42 | private: |
43 | QSocketNotifier m_notifier; |
44 | int m_fdProducer = -1; |
45 | int m_fdConsumer = -1; |
46 | std::atomic_flag m_consumePending{}; |
47 | }; |
48 | |
49 | } // namespace QtPrivate |
50 | |
51 | QT_END_NAMESPACE |
52 | |
53 | #endif // QAUTORESETEVENT_PIPE_P_H |
54 | |