Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
glib_mainloop_on_qeventloop.h
Go to the documentation of this file.
1
8#ifndef GLIB_MAINLOOP_ON_QEVENTLOOP_H
9#define GLIB_MAINLOOP_ON_QEVENTLOOP_H
10
11#include <QThread>
12#include <QMutex>
13#include <QWaitCondition>
14
18class GLibPoller : public QThread
19{
20 Q_OBJECT
21
22protected:
27 explicit GLibPoller(GMainContext *context);
28
33
37 void run() override;
38
40 QMutex mutex_;
41
43 QWaitCondition dispatched_;
44
46 GMainContext *ctx_;
47
50
52 GPollFD *fds_;
53
56
58 int nfds_;
59
60signals:
64 void polled(void);
65
68};
69
73class GLibMainloopOnQEventLoop : public QObject
74{
75 Q_OBJECT
76
77protected:
82 explicit GLibMainloopOnQEventLoop(QObject *parent);
83
88
89protected slots:
93 void checkAndDispatch();
94
95public:
100 static void setup(QObject *parent);
101
102protected:
105};
106
107#endif /* GLIB_MAINLOOP_ON_QEVENTLOOP_H */
Integrates the GLib main loop with the Qt event loop.
Definition glib_mainloop_on_qeventloop.h:74
~GLibMainloopOnQEventLoop()
Destroys the GLibMainloopOnQEventLoop.
Definition glib_mainloop_on_qeventloop.cpp:70
GLibPoller poller_
Definition glib_mainloop_on_qeventloop.h:104
void checkAndDispatch()
Slot triggered to check and dispatch pending GLib events on the Qt main thread.
Definition glib_mainloop_on_qeventloop.cpp:86
static void setup(QObject *parent)
Sets up and initializes the GLib main loop integration.
Definition glib_mainloop_on_qeventloop.cpp:117
A background thread that polls a GLib main context.
Definition glib_mainloop_on_qeventloop.h:19
int allocated_fds_
Definition glib_mainloop_on_qeventloop.h:55
GPollFD * fds_
Definition glib_mainloop_on_qeventloop.h:52
void polled(void)
Signal emitted when the polling operation detects activity.
int priority_
Definition glib_mainloop_on_qeventloop.h:49
~GLibPoller()
Destroys the GLibPoller.
Definition glib_mainloop_on_qeventloop.cpp:21
QWaitCondition dispatched_
Definition glib_mainloop_on_qeventloop.h:43
void run() override
Executes the polling loop in the background thread.
Definition glib_mainloop_on_qeventloop.cpp:27
int nfds_
Definition glib_mainloop_on_qeventloop.h:58
GMainContext * ctx_
Definition glib_mainloop_on_qeventloop.h:46
QMutex mutex_
Definition glib_mainloop_on_qeventloop.h:40