Fix handling rescheduled timers that are already expired.

SVN revision: 56876
This commit is contained in:
Kim Woelders 2011-02-09 21:08:20 +00:00
parent 16063e6868
commit 18399c1f12
1 changed files with 10 additions and 1 deletions

View File

@ -210,7 +210,16 @@ TimersRun(unsigned int t_ms)
}
timer = q_first;
tn = (timer) ? t = timer->at_time - t : 0;
/* If the next (rescheduled) timer is already expired, set timeout time
* to 1 ms. This avoids starving the fd's and should maintain the intended
* (mean) timer rate.
* The (mean) amount of work done in a timer function should of course not
* exceed the timeout time. */
if (timer)
tn = (int)(timer->at_time - t) > 0 ? timer->at_time - t : 1;
else
tn = 0;
if (EDebug(EDBUG_TYPE_TIMERS))
Eprintf("TimersRun - next in %8u\n", tn);