diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-12-17 09:20:46 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-12-17 09:20:46 (GMT) |
commit | bc01bb10da23d0d2308cf02a16947be836bc9a21 (patch) | |
tree | d57fe1ac55f21cf5c426e31659d2aca5c895f363 /src/corelib | |
parent | 11ec7b3694feed8514f9559c7b732ad6217e88c6 (diff) | |
download | Qt-bc01bb10da23d0d2308cf02a16947be836bc9a21.zip Qt-bc01bb10da23d0d2308cf02a16947be836bc9a21.tar.gz Qt-bc01bb10da23d0d2308cf02a16947be836bc9a21.tar.bz2 |
Avoid timer starvation when handling many X11 events
After commit d0d0fdb8e46351b4ab8492de31e5363ef6662b57, timers are
normally run at idle priority. This makes it possible for the X11
handler to starve timers indefinitely. Fix this by enforcing one
normal priority pass of the timer source after we have processed all
X11 events.
This has the added benefit of keeping animation timers smooth and
consistent, which is the intention of this change.
Reviewed-by: Jens Bache-Wiig
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_glib.cpp | 5 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_glib_p.h | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp index 665b73e..16871c3 100644 --- a/src/corelib/kernel/qeventdispatcher_glib.cpp +++ b/src/corelib/kernel/qeventdispatcher_glib.cpp @@ -341,6 +341,11 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context) g_source_attach(&idleTimerSource->source, mainContext); } +void QEventDispatcherGlibPrivate::runTimersOnceWithNormalPriority() +{ + timerSource->runWithIdlePriority = false; +} + QEventDispatcherGlib::QEventDispatcherGlib(QObject *parent) : QAbstractEventDispatcher(*(new QEventDispatcherGlibPrivate), parent) { diff --git a/src/corelib/kernel/qeventdispatcher_glib_p.h b/src/corelib/kernel/qeventdispatcher_glib_p.h index 6a4e726..57cbf94 100644 --- a/src/corelib/kernel/qeventdispatcher_glib_p.h +++ b/src/corelib/kernel/qeventdispatcher_glib_p.h @@ -110,6 +110,8 @@ public: GSocketNotifierSource *socketNotifierSource; GTimerSource *timerSource; GIdleTimerSource *idleTimerSource; + + void runTimersOnceWithNormalPriority(); }; QT_END_NAMESPACE |