mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 22:13:52 +01:00
vtimer: fix crash on spurious hwtimer callback
It seems that there are corner cases where a vtimer was removed, but still there comes a hwtimer callback. This is a bug somewhere in the vtimer or hwtimer. If there still was a vtimer set, then the next one gets called before its time. If there was no other vtimer scheduled, then `timer->action(timer)` crashes. This PR simply fixes the crash, but does not attempt to find the more fundamental bug.
This commit is contained in:
parent
04493cc026
commit
e1705622b7
@ -177,13 +177,18 @@ void vtimer_callback(void *ptr)
|
||||
/* get the vtimer that fired */
|
||||
vtimer_t *timer = (vtimer_t *)queue_remove_head(&shortterm_queue_root);
|
||||
|
||||
if (timer) {
|
||||
#if ENABLE_DEBUG
|
||||
vtimer_print(timer);
|
||||
vtimer_print(timer);
|
||||
#endif
|
||||
DEBUG("vtimer_callback(): Shooting %" PRIu32 ".\n", timer->absolute.microseconds);
|
||||
DEBUG("vtimer_callback(): Shooting %" PRIu32 ".\n", timer->absolute.microseconds);
|
||||
|
||||
/* shoot timer */
|
||||
timer->action(timer);
|
||||
/* shoot timer */
|
||||
timer->action(timer);
|
||||
}
|
||||
else {
|
||||
DEBUG("vtimer_callback(): spurious call.\n");
|
||||
}
|
||||
|
||||
in_callback = false;
|
||||
update_shortterm();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user