diff --git a/include/openbsc/timer.h b/include/openbsc/timer.h index e8dc91a84..b3e809e79 100644 --- a/include/openbsc/timer.h +++ b/include/openbsc/timer.h @@ -1,5 +1,5 @@ /* - * (C) 2008 by Holger Hans Peter Freyther + * (C) 2008, 2009 by Holger Hans Peter Freyther * All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -46,6 +46,7 @@ struct timer_list { struct timeval timeout; int active : 1; int handled : 1; + int in_list : 1; void (*cb)(void*); void *data; diff --git a/src/timer.c b/src/timer.c index 158ee76b7..d2039fd10 100644 --- a/src/timer.c +++ b/src/timer.c @@ -1,5 +1,5 @@ /* - * (C) 2008 by Holger Hans Peter Freyther + * (C) 2008,2009 by Holger Hans Peter Freyther * All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -43,6 +43,7 @@ void add_timer(struct timer_list *timer) if (timer == list_timer) return; + timer->in_list = 1; llist_add(&timer->entry, &timer_list); } @@ -60,8 +61,9 @@ void schedule_timer(struct timer_list *timer, int seconds, int microseconds) void del_timer(struct timer_list *timer) { - if (timer_pending(timer)) { + if (timer->in_list) { timer->active = 0; + timer->in_list = 0; llist_del(&timer->entry); } }