When we stop a timer that's the first in the timer list, ensure

that we adjust that timers `rest' value (with the current getitimer()
values) before using that to adjust the next items `rest' value.
After adjusting that value, restart the timer service so that we've
now got the correct setitimer() values.
This commit is contained in:
Brian Somers 2000-03-14 01:46:31 +00:00
parent f013f33ee2
commit e722aa17f8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=58029

View File

@ -133,15 +133,25 @@ StopTimerNoBlock(struct pppTimer *tp)
pt = t;
if (t) {
if (pt) {
if (pt)
pt->next = t->next;
} else {
else {
TimerList = t->next;
if (TimerList == NULL) /* Last one ? */
timer_TermService(); /* Terminate Timer Service */
}
if (t->next)
t->next->rest += tp->rest;
if (t->next) {
if (!pt) { /* t (tp) was the first in the list */
struct itimerval itimer;
if (getitimer(ITIMER_REAL, &itimer) == 0)
t->rest = itimer.it_value.tv_sec * SECTICKS +
itimer.it_value.tv_usec / TICKUNIT;
}
t->next->rest += t->rest;
if (!pt) /* t->next is now the first in the list */
timer_InitService(1);
}
} else {
/* Search for any pending expired timers */
pt = NULL;