diff options
author | Louai Al-Khanji <louai.al-khanji@theqtcompany.com> | 2015-12-03 10:00:24 -0800 |
---|---|---|
committer | Louai Al-Khanji <louai.al-khanji@theqtcompany.com> | 2016-01-29 03:49:24 +0000 |
commit | e65ffae850a7265c1d477957a5b24865b91ec3ad (patch) | |
tree | 23576ab5fb080169eb47ef79cac2bf417a76b596 /src/corelib/kernel/qeventdispatcher_unix_p.h | |
parent | dae6445e2659c5e8ea797fc48b0fc2dedf70d7c5 (diff) |
QEventDispatcherUNIX: Clean up thread_pipe logic
Change-Id: Ic13ad54a5b3c7bd3e3e5921b3dbbe321690fad21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qeventdispatcher_unix_p.h')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_unix_p.h | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_unix_p.h b/src/corelib/kernel/qeventdispatcher_unix_p.h index b401c07040..d728040343 100644 --- a/src/corelib/kernel/qeventdispatcher_unix_p.h +++ b/src/corelib/kernel/qeventdispatcher_unix_p.h @@ -75,6 +75,27 @@ struct Q_CORE_EXPORT QSocketNotifierSetUNIX Q_DECL_FINAL Q_DECLARE_TYPEINFO(QSocketNotifierSetUNIX, Q_PRIMITIVE_TYPE); +struct QThreadPipe +{ + QThreadPipe(); + ~QThreadPipe(); + + bool init(); + pollfd prepare() const; + + void wakeUp(); + int check(const pollfd &pfd); + + // note for eventfd(7) support: + // if fds[1] is -1, then eventfd(7) is in use and is stored in fds[0] + int fds[2]; + QAtomicInt wakeUps; + +#if defined(Q_OS_VXWORKS) + static const int len_name = 20; + char name[len_name]; +#endif +}; class Q_CORE_EXPORT QEventDispatcherUNIX : public QAbstractEventDispatcher { @@ -114,26 +135,19 @@ public: QEventDispatcherUNIXPrivate(); ~QEventDispatcherUNIXPrivate(); - int processThreadWakeUp(const pollfd &pfd); - int activateTimers(); void markPendingSocketNotifiers(); int activateSocketNotifiers(); void setSocketNotifierPending(QSocketNotifier *notifier); - // note for eventfd(7) support: - // if thread_pipe[1] is -1, then eventfd(7) is in use and is stored in thread_pipe[0] - int thread_pipe[2]; - + QThreadPipe threadPipe; QVector<pollfd> pollfds; QHash<int, QSocketNotifierSetUNIX> socketNotifiers; QVector<QSocketNotifier *> pendingNotifiers; QTimerInfoList timerList; - - QAtomicInt wakeUps; QAtomicInt interrupt; // bool }; |