diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-02-16 13:52:12 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2011-02-16 13:52:12 (GMT) |
commit | 42adaaa0dffa9df387a145181bc97ee3bb9a4c7b (patch) | |
tree | b0cdc9d1ca506b374a3cc33fb5c982993b0f5f77 | |
parent | b1fa3580515e7f10a9bd06b6a9e7733635f95cab (diff) | |
download | Qt-42adaaa0dffa9df387a145181bc97ee3bb9a4c7b.zip Qt-42adaaa0dffa9df387a145181bc97ee3bb9a4c7b.tar.gz Qt-42adaaa0dffa9df387a145181bc97ee3bb9a4c7b.tar.bz2 |
Fix thread starvation when processEvents() is called in a tight loop
One of the qftp test cases calls processEvents() in a tight loop instead
of using an event loop. This was causing the application to hang on symbian
as it blocked a lower priority system thread and the WLAN connection
never completed.
Although calling processEvents in a tight loop is bad practice, it works
on other OS where thread priorities are dynamic.
Reviewed-by: mread
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index b3a3d4d..0b7682c 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -818,6 +818,14 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla CActiveScheduler::Current()->WaitForAnyRequest(); } else { if (thread.RequestCount() == 0) { +#ifdef QT_SYMBIAN_PRIORITY_DROP + if (idleDetectorThread()->hasRun()) { + m_lastIdleRequestTimer.start(); + idleDetectorThread()->kick(); + } else if (m_lastIdleRequestTimer.elapsed() > maxBusyTime) { + User::AfterHighRes(m_delay); + } +#endif break; } // This one should return without delay. |