QNX: Fix input lag
authorThomas McGuire <thomas.mcguire.qnx@kdab.com>
Fri, 5 Oct 2012 13:55:43 +0000 (15:55 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 8 Oct 2012 06:33:48 +0000 (08:33 +0200)
We were breaking out of select() too early with a timeout of -1.

Change-Id: Icd47b307a6f3a9d11c862722759e24f560e72e9e
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
src/corelib/kernel/qeventdispatcher_blackberry.cpp

index 626692c..a553999 100644 (file)
@@ -245,6 +245,14 @@ void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notif
 
 static inline bool updateTimeout(int *timeout, const struct timeval &start)
 {
+    // A timeout of -1 means we should block indefinitely. If we get here, we got woken up by a
+    // non-IO BPS event, and that event has been processed already. This means we can go back and
+    // block in bps_get_event().
+    // Note that processing the BPS event might have triggered a wakeup, in that case we get a
+    // IO event in the next bps_get_event() right away.
+    if (*timeout == -1)
+        return true;
+
     if (Q_UNLIKELY(!QElapsedTimer::isMonotonic())) {
         // we cannot recalculate the timeout without a monotonic clock as the time may have changed
         return false;