mirror of https://gerrit.osmocom.org/libosmocore
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 <pablo@gnumonks.org> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
parent
cc90d494ce
commit
a71b8eaca7
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue