Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qeventdispatcher_unix_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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#ifndef QEVENTDISPATCHER_UNIX_P_H
5#define QEVENTDISPATCHER_UNIX_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 "QtCore/qabstracteventdispatcher.h"
19#include "QtCore/qlist.h"
20#include "private/qabstracteventdispatcher_p.h"
21#include "private/qcore_unix_p.h"
22#include "QtCore/qvarlengtharray.h"
23#include "QtCore/qhash.h"
24#include "private/qtimerinfo_unix_p.h"
25
27
29
30struct Q_CORE_EXPORT QSocketNotifierSetUNIX final
31{
32 inline QSocketNotifierSetUNIX() noexcept;
33
34 inline bool isEmpty() const noexcept;
35 inline short events() const noexcept;
36
37 QSocketNotifier *notifiers[3];
38};
39
41
43{
46
47 bool init();
48 pollfd prepare() const;
49
50 void wakeUp();
51 int check(const pollfd &pfd);
52
53 // note for eventfd(7) support:
54 // if fds[1] is -1, then eventfd(7) is in use and is stored in fds[0]
55 int fds[2];
57
58#if defined(Q_OS_VXWORKS)
59 static const int len_name = 20;
60 char name[len_name];
61#endif
62};
63
65{
67 Q_DECLARE_PRIVATE(QEventDispatcherUNIX)
68
69public:
70 explicit QEventDispatcherUNIX(QObject *parent = nullptr);
72
73 bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
74
75 void registerSocketNotifier(QSocketNotifier *notifier) final;
76 void unregisterSocketNotifier(QSocketNotifier *notifier) final;
77
78 void registerTimer(int timerId, qint64 interval, Qt::TimerType timerType, QObject *object) final;
79 bool unregisterTimer(int timerId) final;
80 bool unregisterTimers(QObject *object) final;
81 QList<TimerInfo> registeredTimers(QObject *object) const final;
82
83 int remainingTime(int timerId) final;
84
85 void wakeUp() override;
86 void interrupt() final;
87
88protected:
90};
91
93{
94 Q_DECLARE_PUBLIC(QEventDispatcherUNIX)
95
96public:
99
100 int activateTimers();
101
102 void markPendingSocketNotifiers();
103 int activateSocketNotifiers();
104 void setSocketNotifierPending(QSocketNotifier *notifier);
105
108
111
114};
115
117{
118 notifiers[0] = nullptr;
119 notifiers[1] = nullptr;
120 notifiers[2] = nullptr;
121}
122
123inline bool QSocketNotifierSetUNIX::isEmpty() const noexcept
124{
125 return !notifiers[0] && !notifiers[1] && !notifiers[2];
126}
127
128inline short QSocketNotifierSetUNIX::events() const noexcept
129{
130 short result = 0;
131
132 if (notifiers[0])
133 result |= POLLIN;
134
135 if (notifiers[1])
136 result |= POLLOUT;
137
138 if (notifiers[2])
139 result |= POLLPRI;
140
141 return result;
142}
143
145
146#endif // QEVENTDISPATCHER_UNIX_P_H
DarwinBluetooth::LECBManagerNotifier * notifier
\inmodule QtCore
Definition qatomic.h:112
QHash< int, QSocketNotifierSetUNIX > socketNotifiers
QList< QSocketNotifier * > pendingNotifiers
\inmodule QtCore
Definition qhash.h:818
Definition qlist.h:74
\inmodule QtCore
Definition qobject.h:90
\inmodule QtCore
EGLint EGLint EGLint EGLint int int int int * fds
Combined button and popup list for selecting options.
TimerType
GLbitfield flags
GLuint name
GLuint64EXT * result
[6]
#define Q_OBJECT
@ Q_PRIMITIVE_TYPE
Definition qtypeinfo.h:144
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:163
long long qint64
Definition qtypes.h:55
QSocketNotifier * notifiers[3]
short events() const noexcept
bool isEmpty() const noexcept
int check(const pollfd &pfd)
pollfd prepare() const
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent