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

Christopher James Halse Rogers christopher.halse.rogers at canonical.com
Sun Dec 5 16:24:01 PST 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>
Reviewed-by: Adam Jackson <ajax at redhat.com>
---
 Xext/sync.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/Xext/sync.c b/Xext/sync.c
index fc7c462..93aee37 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -2292,6 +2292,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.2.3



More information about the xorg-devel mailing list