From bcc69cf16d15600e77a24e7ffc5fd43a60279b21 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Fri, 30 Oct 2026 20:31:05 +0000 Subject: [PATCH] Unified use of notify_about_timer_change --- include/etl/intrusive_timer.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/etl/intrusive_timer.h b/include/etl/intrusive_timer.h index c10fafc6..86d51ec8 100644 --- a/include/etl/intrusive_timer.h +++ b/include/etl/intrusive_timer.h @@ -247,6 +247,8 @@ namespace etl // Is this the next timer that is due to expire? bool notify = (active_list.first() == &timer_); + notify_about_timer_change(notify, &timer_); + lock_policy.unlock(); if (is_started && immediate_) @@ -255,8 +257,6 @@ namespace etl timer_.invoke(); } - notify_about_timer_change(notify, &timer_); - return is_started; } @@ -266,17 +266,18 @@ namespace etl bool stop(etl::timer::node& timer_) ETL_NOEXCEPT { bool is_stopped = false; + bool notify = false; lock_policy.lock(); if (timer_.is_active()) { + notify = (active_list.first() == &timer_); stop_timer(timer_); is_stopped = true; } - // The next timer has changed, so notify the user. - active_notify_time_to_next->invoke(active_list.first()->get_delta()); + notify_about_timer_change(notify, active_list.first()); lock_policy.unlock();