Wireshark  4.3.0
The Wireshark network protocol analyzer
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 #include <glib.h>
15 
16 class GLibPoller : public QThread
17 {
18  Q_OBJECT
19 
20 protected:
21  explicit GLibPoller(GMainContext *context);
22  ~GLibPoller();
23 
24  void run() override;
25 
26  QMutex mutex_;
27  QWaitCondition dispatched_;
28  GMainContext *ctx_;
29  gint priority_;
30  GPollFD *fds_;
31  gint allocated_fds_, nfds_;
32 
33 signals:
34  void polled(void);
35 
36  friend class GLibMainloopOnQEventLoop;
37 };
38 
39 class GLibMainloopOnQEventLoop : public QObject
40 {
41  Q_OBJECT
42 
43 protected:
44  explicit GLibMainloopOnQEventLoop(QObject *parent);
46 
47 protected slots:
48  void checkAndDispatch();
49 
50 public:
51  static void setup(QObject *parent);
52 
53 protected:
54  GLibPoller poller_;
55 };
56 
57 #endif /* GLIB_MAINLOOP_ON_QEVENTLOOP_H */
Definition: glib_mainloop_on_qeventloop.h:40
Definition: glib_mainloop_on_qeventloop.h:17