diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-09-15 09:05:06 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-09-15 09:15:37 (GMT) |
commit | e3801c20bd3626c3c9c9fac110ee2f9e4269e3c8 (patch) | |
tree | 4e63e6c30333b28fd4cd88dc0ad58a846e50f36e /src/corelib | |
parent | 05ab8ad1577fc038aa2b3bd96cedda54e6a64979 (diff) | |
download | Qt-e3801c20bd3626c3c9c9fac110ee2f9e4269e3c8.zip Qt-e3801c20bd3626c3c9c9fac110ee2f9e4269e3c8.tar.gz Qt-e3801c20bd3626c3c9c9fac110ee2f9e4269e3c8.tar.bz2 |
QEventDispatcherUnix: do not process too many timer if other events need to be processed first
Task-number: QTBUG-13633
Reviewed-by: Brad
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_unix.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 9dadd82..f50994c 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -549,18 +549,22 @@ int QTimerInfoList::activateTimers() if (qt_disable_lowpriority_timers || isEmpty()) return 0; // nothing to do - bool firstTime = true; - timeval currentTime; - int n_act = 0, maxCount = count(); + int n_act = 0, maxCount = 0; firstTimerInfo = 0; - while (maxCount--) { - currentTime = updateCurrentTime(); - if (firstTime) { - repairTimersIfNeeded(); - firstTime = false; - } + timeval currentTime = updateCurrentTime(); + repairTimersIfNeeded(); + + // Find out how many timer have expired + for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) { + if (currentTime < (*it)->timeout) + break; + maxCount++; + } + + //fire the timers. + while (maxCount--) { if (isEmpty()) break; |