[PATCH 2/2] IDLETIME: Fix edge-case in IdleTimeBlockHandler

Christopher James Halse Rogers christopher.halse.rogers at canonical.com
Mon Aug 23 20:48:04 PDT 2010


Ensure that if we're called exactly on the threshold of a
NegativeTransition trigger that we reshedule to pick up
an idle time over the threshold.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers at canonical.com>
---
 Xext/sync.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/Xext/sync.c b/Xext/sync.c
index c00e692..314b63e 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -2322,6 +2322,14 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
 		break;
 	    }
 	}
+	/* 
+	 * We've been called exactly on the idle time, but we have a
+	 * NegativeTransition trigger which requires a transition from an
+	 * idle time greater than this.  Schedule a wakeup for the next
+	 * millisecond so we won't miss a transition.
+	 */
+	if (XSyncValueEqual (idle, *pIdleTimeValueLess))
+	    AdjustWaitForDelay(wt, 1);
     }
     else if (pIdleTimeValueGreater)
     {
-- 
1.7.1



More information about the xorg-devel mailing list