CheckAllTimers() is called with signals blocked. Calling TimerForce within CheckAllTimers is inefficient because: (a) signals are be blocked & unblocked again (b) the timer list is traversed again (c) CheckAllTimers() ignores the return value
Instead, just call DoTimer() directly. Signed-off-by: Daniel Kurtz <[email protected]> --- os/WaitFor.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/os/WaitFor.c b/os/WaitFor.c index 2aab6d1..23347ec 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -355,15 +355,17 @@ WaitForSomething(int *pClientsReady) static void CheckAllTimers(void) { + OsTimerPtr *prev; OsTimerPtr timer; CARD32 now; start: now = GetTimeInMillis(); - for (timer = timers; timer; timer = timer->next) { + for (prev = &timers; *prev; prev = &(*prev)->next) { + timer = *prev; if (timer->expires - now > timer->delta + 250) { - TimerForce(timer); + DoTimer(timer, now, prev); goto start; } } -- 1.7.7.3 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
