This is an automated email from the ASF dual-hosted git repository. jiuzhudong pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit b685d97199a09c51ed77997e8f9a4c63b9e00d9a Author: ouyangxiangzhen <[email protected]> AuthorDate: Wed Jan 28 19:52:20 2026 +0800 sched/hrtimer: Simplify the hrtimer. This commit simplified the hrtimer. Signed-off-by: ouyangxiangzhen <[email protected]> --- sched/hrtimer/hrtimer_process.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sched/hrtimer/hrtimer_process.c b/sched/hrtimer/hrtimer_process.c index 66dc6e6a817..8974964a57c 100644 --- a/sched/hrtimer/hrtimer_process.c +++ b/sched/hrtimer/hrtimer_process.c @@ -81,15 +81,20 @@ void hrtimer_process(uint64_t now) flags = write_seqlock_irqsave(&g_hrtimer_lock); - /* Fetch the earliest active timer */ + for (; ; ) + { + /* Fetch the earliest active timer */ - hrtimer = hrtimer_get_first(); - expired = hrtimer->expired; + hrtimer = hrtimer_get_first(); + expired = hrtimer->expired; - /* Check if the timer has expired */ + /* Check if the timer has expired */ + + if (!HRTIMER_TIME_BEFORE_EQ(expired, now)) + { + break; + } - while (HRTIMER_TIME_BEFORE_EQ(expired, now)) - { /* Remove the expired timer from the timer queue */ func = hrtimer->func; @@ -125,11 +130,6 @@ void hrtimer_process(uint64_t now) hrtimer->func = func; hrtimer_insert(hrtimer); } - - /* Fetch the next earliest timer */ - - hrtimer = hrtimer_get_first(); - expired = hrtimer->expired; } hrtimer_unmark_running(cpu);
