summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2010-06-04 10:53:36 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2010-06-04 12:30:36 (GMT)
commitcd8a6d6836f04f66d3e7083c97f7873240afa433 (patch)
treecd6da8dfcaec98106098ed8e5726735136234b54 /src/corelib/kernel
parentdbd16b3b6d2e6b030dd52e90eb3a38dc1a73c180 (diff)
downloadQt-cd8a6d6836f04f66d3e7083c97f7873240afa433.zip
Qt-cd8a6d6836f04f66d3e7083c97f7873240afa433.tar.gz
Qt-cd8a6d6836f04f66d3e7083c97f7873240afa433.tar.bz2
Avoid timer starvation during high posted event activity
Similar to commit bc01bb10da23d0d2308cf02a16947be836bc9a21, we need to avoid starvation of the idle time source by forcing a single, normal priority pass after processing posted events. Reviewed-by: ogoffart Task-number: QT-3467
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index fd36be4..9c1c827 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -246,6 +246,7 @@ struct GPostEventSource
GSource source;
QAtomicInt serialNumber;
int lastSerialNumber;
+ QEventDispatcherGlibPrivate *d;
};
static gboolean postEventSourcePrepare(GSource *s, gint *timeout)
@@ -274,6 +275,7 @@ static gboolean postEventSourceDispatch(GSource *s, GSourceFunc, gpointer)
GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s);
source->lastSerialNumber = source->serialNumber;
QCoreApplication::sendPostedEvents();
+ source->d->runTimersOnceWithNormalPriority();
return true; // i dunno, george...
}
@@ -313,6 +315,7 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs,
sizeof(GPostEventSource)));
postEventSource->serialNumber = 1;
+ postEventSource->d = this;
g_source_set_can_recurse(&postEventSource->source, true);
g_source_attach(&postEventSource->source, mainContext);