diff --git a/os/include/os/alarm.h b/os/include/os/alarm.h index b41d954b5b..43f51a6279 100644 --- a/os/include/os/alarm.h +++ b/os/include/os/alarm.h @@ -131,6 +131,14 @@ namespace Genode { * \return true if an alarm is scheduled */ bool next_deadline(Alarm::Time *deadline); + + /** + * Determine if given alarm object is current head element + * + * \param alarm alarm object + * \return true if alarm is head element of timeout queue + */ + bool head_timeout(const Alarm * alarm) { return _head == alarm; } }; } diff --git a/os/src/drivers/timer/include/timer_session_component.h b/os/src/drivers/timer/include/timer_session_component.h index 259c704e12..d97843f063 100644 --- a/os/src/drivers/timer/include/timer_session_component.h +++ b/os/src/drivers/timer/include/timer_session_component.h @@ -193,7 +193,8 @@ namespace Timer { } else schedule_absolute(alarm, now + timeout); /* interrupt current 'wait_for_timeout' */ - _platform_timer->schedule_timeout(0); + if (head_timeout(alarm)) + _platform_timer->schedule_timeout(0); } unsigned long curr_time() const