timer connection: fix mixing of time sources
We update the alarm-scheduler time with results of Timer::Connection::curr_time when we schedule new timeouts but when handling the signal from the Timer server we updated the alarm-scheduler time with the result of Timer::Connection::elapsed_us. Mixing times like this could cause a non-monotone time value in the alarm scheduler. The alarm scheduler then thought that the time value wrapped and triggered all timeouts immediately. The problem was fixed by always using Timer::Connection::curr_time as time source. Ref #2490
This commit is contained in:
parent
dae563725b
commit
3f37a12e2d
|
@ -65,9 +65,11 @@ bool Timeout::Alarm::on_alarm(unsigned)
|
||||||
** Alarm_timeout_scheduler **
|
** Alarm_timeout_scheduler **
|
||||||
*****************************/
|
*****************************/
|
||||||
|
|
||||||
void Alarm_timeout_scheduler::handle_timeout(Duration curr_time)
|
void Alarm_timeout_scheduler::handle_timeout(Duration)
|
||||||
{
|
{
|
||||||
unsigned long const curr_time_us = curr_time.trunc_to_plain_us().value;
|
unsigned long const curr_time_us =
|
||||||
|
_time_source.curr_time().trunc_to_plain_us().value;
|
||||||
|
|
||||||
_alarm_scheduler.handle(curr_time_us);
|
_alarm_scheduler.handle(curr_time_us);
|
||||||
|
|
||||||
unsigned long sleep_time_us;
|
unsigned long sleep_time_us;
|
||||||
|
|
Loading…
Reference in New Issue