Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
// Qt-Security score:significant reason:default
4
5
#
ifndef
QEVENTDISPATCHER_UNIX_P_H
6
#
define
QEVENTDISPATCHER_UNIX_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
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#
include
"QtCore/qabstracteventdispatcher.h"
20
#
include
"QtCore/qlist.h"
21
#
include
"private/qabstracteventdispatcher_p.h"
22
#
include
"private/qcore_unix_p.h"
23
#
include
"QtCore/qvarlengtharray.h"
24
#
include
"QtCore/qhash.h"
25
#
include
"private/qtimerinfo_unix_p.h"
26
27
QT_BEGIN_NAMESPACE
28
29
class
QEventDispatcherUNIXPrivate;
30
31
struct
Q_CORE_EXPORT QSocketNotifierSetUNIX final
32
{
33
inline
QSocketNotifierSetUNIX()
noexcept
;
34
35
inline
bool
isEmpty()
const
noexcept
;
36
inline
short
events()
const
noexcept
;
37
38
QSocketNotifier *notifiers[3];
39
};
40
41
Q_DECLARE_TYPEINFO
(QSocketNotifierSetUNIX, Q_PRIMITIVE_TYPE);
42
43
struct
QThreadPipe
44
{
45
QThreadPipe
();
46
~
QThreadPipe
();
47
48
bool
init
();
49
pollfd
prepare
()
const
;
50
51
void
wakeUp
();
52
int
check
(
const
pollfd &pfd);
53
54
// note for eventfd(7) support:
55
// fds[0] stores the eventfd, fds[1] is unused
56
int
fds
[2] = { -1, -1 };
57
QAtomicInt
wakeUps
;
58
59
#
if
defined
(
Q_OS_VXWORKS
)
60
static
constexpr
int
len_name
= 20;
61
char
name
[
len_name
] = {};
62
#
endif
63
};
64
65
class
Q_CORE_EXPORT
QEventDispatcherUNIX
:
public
QAbstractEventDispatcherV2
66
{
67
Q_OBJECT
68
Q_DECLARE_PRIVATE(QEventDispatcherUNIX)
69
70
public
:
71
explicit
QEventDispatcherUNIX(QObject *parent =
nullptr
);
72
~QEventDispatcherUNIX();
73
74
bool
processEvents(QEventLoop::ProcessEventsFlags flags) override;
75
76
void
registerSocketNotifier(QSocketNotifier *notifier) final;
77
void
unregisterSocketNotifier(QSocketNotifier *notifier) final;
78
79
void
registerTimer(Qt::TimerId timerId, Duration interval, Qt::TimerType timerType,
80
QObject *object) override final;
81
bool
unregisterTimer(Qt::TimerId timerId) override final;
82
bool
unregisterTimers(QObject *object) override final;
83
QList<TimerInfoV2> timersForObject(QObject *object)
const
override final;
84
Duration remainingTime(Qt::TimerId timerId)
const
override final;
85
86
void
wakeUp() override;
87
void
interrupt() final;
88
89
protected
:
90
QEventDispatcherUNIX(QEventDispatcherUNIXPrivate &dd, QObject *parent =
nullptr
);
91
};
92
93
class
Q_CORE_EXPORT
QEventDispatcherUNIXPrivate
:
public
QAbstractEventDispatcherPrivate
94
{
95
Q_DECLARE_PUBLIC(QEventDispatcherUNIX)
96
97
public
:
98
QEventDispatcherUNIXPrivate();
99
~QEventDispatcherUNIXPrivate();
100
101
int
activateTimers();
102
103
void
markPendingSocketNotifiers();
104
int
activateSocketNotifiers();
105
void
setSocketNotifierPending(QSocketNotifier *notifier);
106
107
QThreadPipe threadPipe;
108
QList<pollfd> pollfds;
109
110
QHash<
int
, QSocketNotifierSetUNIX> socketNotifiers;
111
QList<QSocketNotifier *> pendingNotifiers;
112
113
QTimerInfoList timerList;
114
QAtomicInt interrupt;
// bool
115
QAtomicInt wakeUpCalledDuringProcessEvents;
// bool
116
};
117
118
inline
QSocketNotifierSetUNIX::QSocketNotifierSetUNIX()
noexcept
119
{
120
notifiers[0] =
nullptr
;
121
notifiers[1] =
nullptr
;
122
notifiers[2] =
nullptr
;
123
}
124
125
inline
bool
QSocketNotifierSetUNIX::isEmpty()
const
noexcept
126
{
127
return
!notifiers[0] && !notifiers[1] && !notifiers[2];
128
}
129
130
inline
short
QSocketNotifierSetUNIX::events()
const
noexcept
131
{
132
short
result = 0;
133
134
if
(notifiers[0])
135
result |= POLLIN;
136
137
if
(notifiers[1])
138
result |= POLLOUT;
139
140
if
(notifiers[2])
141
result |= POLLPRI;
142
143
return
result;
144
}
145
146
QT_END_NAMESPACE
147
148
#
endif
// QEVENTDISPATCHER_UNIX_P_H
QEventDispatcherGlibPrivate
Definition
qeventdispatcher_glib_p.h:65
QEventDispatcherGlib
Definition
qeventdispatcher_glib_p.h:29
QEventDispatcherUNIXPrivate
Definition
qeventdispatcher_unix_p.h:94
QEventDispatcherUNIX
Definition
qeventdispatcher_unix_p.h:66
timerSourcePrepareHelper
static gboolean timerSourcePrepareHelper(GTimerSource *src, gint *timeout)
Definition
qeventdispatcher_glib.cpp:102
postEventSourceDispatch
static gboolean postEventSourceDispatch(GSource *s, GSourceFunc, gpointer)
Definition
qeventdispatcher_glib.cpp:245
timerSourceCheck
static gboolean timerSourceCheck(GSource *source)
Definition
qeventdispatcher_glib.cpp:140
idleTimerSourcePrepare
static gboolean idleTimerSourcePrepare(GSource *source, gint *timeout)
Definition
qeventdispatcher_glib.cpp:173
socketNotifierSourcePrepare
static gboolean socketNotifierSourcePrepare(GSource *, gint *timeout)
Definition
qeventdispatcher_glib.cpp:38
idleTimerSourceDispatch
static gboolean idleTimerSourceDispatch(GSource *source, GSourceFunc, gpointer)
Definition
qeventdispatcher_glib.cpp:198
postEventSourcePrepare
static gboolean postEventSourcePrepare(GSource *s, gint *timeout)
Definition
qeventdispatcher_glib.cpp:223
idleTimerSourceCheck
static gboolean idleTimerSourceCheck(GSource *source)
Definition
qeventdispatcher_glib.cpp:187
timerSourceCheckHelper
static gboolean timerSourceCheckHelper(GTimerSource *src)
Definition
qeventdispatcher_glib.cpp:115
socketNotifierSourceCheck
static gboolean socketNotifierSourceCheck(GSource *source)
Definition
qeventdispatcher_glib.cpp:45
postEventSourceCheck
static gboolean postEventSourceCheck(GSource *source)
Definition
qeventdispatcher_glib.cpp:240
socketNotifierSourceDispatch
static gboolean socketNotifierSourceDispatch(GSource *source, GSourceFunc, gpointer)
Definition
qeventdispatcher_glib.cpp:69
timerSourcePrepare
static gboolean timerSourcePrepare(GSource *source, gint *timeout)
Definition
qeventdispatcher_glib.cpp:124
timerSourceDispatch
static gboolean timerSourceDispatch(GSource *source, GSourceFunc, gpointer)
Definition
qeventdispatcher_glib.cpp:148
GMainContext
struct _GMainContext GMainContext
Definition
qeventdispatcher_glib_p.h:22
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
Q_DECLARE_TYPEINFO
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)
GIdleTimerSource
Definition
qeventdispatcher_glib.cpp:168
GIdleTimerSource::source
GSource source
Definition
qeventdispatcher_glib.cpp:169
GIdleTimerSource::timerSource
GTimerSource * timerSource
Definition
qeventdispatcher_glib.cpp:170
GPostEventSource
Definition
qeventdispatcher_glib.cpp:215
GPostEventSource::serialNumber
QAtomicInt serialNumber
Definition
qeventdispatcher_glib.cpp:217
GPostEventSource::d
QEventDispatcherGlibPrivate * d
Definition
qeventdispatcher_glib.cpp:220
GPostEventSource::lastSerialNumber
int lastSerialNumber
Definition
qeventdispatcher_glib.cpp:218
GPostEventSource::source
GSource source
Definition
qeventdispatcher_glib.cpp:216
GPostEventSource::pendingSerialNumber
int pendingSerialNumber
Definition
qeventdispatcher_glib.cpp:219
GSocketNotifierSource
Definition
qeventdispatcher_glib.cpp:32
GSocketNotifierSource::source
GSource source
Definition
qeventdispatcher_glib.cpp:33
GSocketNotifierSource::pollfds
QList< GPollFDWithQSocketNotifier * > pollfds
Definition
qeventdispatcher_glib.cpp:34
GSocketNotifierSource::activeNotifierPos
qsizetype activeNotifierPos
Definition
qeventdispatcher_glib.cpp:35
GTimerSource
Definition
qeventdispatcher_glib.cpp:95
GTimerSource::timerList
QTimerInfoList timerList
Definition
qeventdispatcher_glib.cpp:97
GTimerSource::processEventsFlags
QEventLoop::ProcessEventsFlags processEventsFlags
Definition
qeventdispatcher_glib.cpp:98
GTimerSource::runWithIdlePriority
bool runWithIdlePriority
Definition
qeventdispatcher_glib.cpp:99
GTimerSource::source
GSource source
Definition
qeventdispatcher_glib.cpp:96
QThreadPipe
Definition
qeventdispatcher_unix_p.h:44
QThreadPipe::fds
int fds[2]
Definition
qeventdispatcher_unix_p.h:56
QThreadPipe::check
int check(const pollfd &pfd)
Definition
qeventdispatcher_unix.cpp:166
QThreadPipe::wakeUp
void wakeUp()
Definition
qeventdispatcher_unix.cpp:154
QThreadPipe::init
bool init()
Definition
qeventdispatcher_unix.cpp:98
QThreadPipe::prepare
pollfd prepare() const
Definition
qeventdispatcher_unix.cpp:149
QThreadPipe::~QThreadPipe
~QThreadPipe()
Definition
qeventdispatcher_unix.cpp:68
QThreadPipe::QThreadPipe
QThreadPipe()
Definition
qeventdispatcher_unix.cpp:64
QThreadPipe::wakeUps
QAtomicInt wakeUps
Definition
qeventdispatcher_unix_p.h:57
qtbase
src
corelib
kernel
qeventdispatcher_unix_p.h
Generated on
for Qt by
1.18.0