Add assert for correct state when removing timer

This commit is contained in:
Nils O. Selåsdal
2013-10-05 00:55:21 +02:00
parent f4b1d81dcf
commit f2f2ed247f
+2
View File
@@ -76,6 +76,8 @@ void uc_timers_remove(struct UCTimers *timers, struct UCTimer *timer)
timer->ready_entry.tqe_prev = (struct UCTimer **)105; timer->ready_entry.tqe_prev = (struct UCTimer **)105;
return; return;
} }
assert(timer->state == UC_TIMER_ACTIVE ||
timer->state == UC_TIMER_PENDING);
uc_rb_remove(&timers->timer_tree, &timer->rb_node); //remove it, safe for the uc_rb_remove(&timers->timer_tree, &timer->rb_node); //remove it, safe for the
//callback to re_add it //callback to re_add it