From a71b8eaca7eed4dfc96f2cebabfc26430416c2e9 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sun, 13 Nov 2011 10:11:31 +0100 Subject: timer: Better fix to the timer re-scheduling situation As it turns out, the previous fix didn't cover the case of a timer X being re-scheduled inside a timer call back expiring at the same time as the previous X instance. Written-by: Pablo Neira Ayuso Signed-off-by: Sylvain Munaut --- src/timer.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/timer.c b/src/timer.c index 77fb0039..79d4ad6d 100644 --- a/src/timer.c +++ b/src/timer.c @@ -69,12 +69,9 @@ static void __add_timer(struct osmo_timer_list *timer) */ void osmo_timer_add(struct osmo_timer_list *timer) { - if (timer->active) { - rb_erase(&timer->node, &timer_root); - } else { - timer->active = 1; - INIT_LLIST_HEAD(&timer->list); - } + osmo_timer_del(timer); + timer->active = 1; + INIT_LLIST_HEAD(&timer->list); __add_timer(timer); } -- cgit v1.2.3