Fix bug #48568 (timeouts does not support late firing properly) by assuming sys_check_timeouts() jitter can' be too bad

This commit is contained in:
sg 2016-07-27 21:16:22 +02:00
parent 1bb2539f74
commit a326b057b3

View File

@ -246,6 +246,12 @@ sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg)
if (t->next == NULL || t->next->time > timeout->time) {
if (t->next != NULL) {
t->next->time -= timeout->time;
} else if (timeout->time > msecs) {
/* If this is the case, 'timeouts_last_time' and 'now' differs too much.
This can be due to sys_check_timeouts() not being called at the right
times, but also when stopping in a breakpoint. Anyway, let's assume
this is not wanted, so add the first timer's time instead of 'diff' */
timeout->time = msecs + next_timeout->time;
}
timeout->next = t->next;
t->next = timeout;