Commit a5b005c1 authored by Pekka Pessi's avatar Pekka Pessi
Browse files

Fixed su_timer_set_for_ever().

darcs-hash:20060324153955-65a35-33d114f99fbe7a593a74acf8a68050b01590bee6.gz
parent 9c760852
...@@ -435,6 +435,8 @@ int su_timer_set_for_ever(su_timer_t *t, ...@@ -435,6 +435,8 @@ int su_timer_set_for_ever(su_timer_t *t,
} }
t->sut_running = run_for_ever; t->sut_running = run_for_ever;
t->sut_run = now;
t->sut_woken = 0;
su_timer_set0(timers, t, wakeup, arg, su_time_add(now, t->sut_duration)); su_timer_set0(timers, t, wakeup, arg, su_time_add(now, t->sut_duration));
...@@ -514,18 +516,19 @@ int su_timer_expire(su_timer_t ** const timers, ...@@ -514,18 +516,19 @@ int su_timer_expire(su_timer_t ** const timers,
f(su_root_magic(su_task_root(t->sut_task)), t, t->sut_arg), n++; f(su_root_magic(su_task_root(t->sut_task)), t, t->sut_arg), n++;
} }
} }
else else {
t->sut_woken++;
f(su_root_magic(su_task_root(t->sut_task)), t, t->sut_arg), n++; f(su_root_magic(su_task_root(t->sut_task)), t, t->sut_arg), n++;
}
if (t->sut_running) { if (t->sut_running == run_at_intervals) {
next = su_time_add(t->sut_run, (t->sut_woken + 1) * t->sut_duration); next = su_time_add(t->sut_run, (t->sut_woken + 1) * t->sut_duration);
su_timer_set0(timers, t, f, t->sut_arg, next); su_timer_set0(timers, t, f, t->sut_arg, next);
} }
} else if (t->sut_running == run_for_ever) {
else next = su_time_add(now, t->sut_duration);
if (t->sut_running) {
next = su_time_add(t->sut_run, (t->sut_woken + 1) * t->sut_duration);
su_timer_set0(timers, t, f, t->sut_arg, next); su_timer_set0(timers, t, f, t->sut_arg, next);
}
} }
else { else {
f(su_root_magic(su_task_root(t->sut_task)), t, t->sut_arg); n++; f(su_root_magic(su_task_root(t->sut_task)), t, t->sut_arg); n++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment