Bug #10296: Fix timer rescheduling.

This commit is contained in:
Tomas Janousek 2007-03-28 14:46:30 -04:00 committed by Adam Jackson
parent 5ba4d9eedf
commit 8c7f56d92d

View File

@ -125,7 +125,7 @@ struct _OsTimerRec {
}; };
static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev); static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev);
static void CheckAllTimers(CARD32 now); static void CheckAllTimers(void);
static OsTimerPtr timers = NULL; static OsTimerPtr timers = NULL;
/***************** /*****************
@ -204,7 +204,7 @@ WaitForSomething(int *pClientsReady)
timeout = timers->expires - now; timeout = timers->expires - now;
if (timeout > 0 && timeout > timers->delta + 250) { if (timeout > 0 && timeout > timers->delta + 250) {
/* time has rewound. reset the timers. */ /* time has rewound. reset the timers. */
CheckAllTimers(now); CheckAllTimers();
} }
if (timers) { if (timers) {
@ -436,11 +436,14 @@ ANYSET(FdMask *src)
/* If time has rewound, re-run every affected timer. /* If time has rewound, re-run every affected timer.
* Timers might drop out of the list, so we have to restart every time. */ * Timers might drop out of the list, so we have to restart every time. */
static void static void
CheckAllTimers(CARD32 now) CheckAllTimers(void)
{ {
OsTimerPtr timer; OsTimerPtr timer;
CARD32 now;
start: start:
now = GetTimeInMillis();
for (timer = timers; timer; timer = timer->next) { for (timer = timers; timer; timer = timer->next) {
if (timer->expires - now > timer->delta + 250) { if (timer->expires - now > timer->delta + 250) {
TimerForce(timer); TimerForce(timer);