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 33c6b4115cf11adb56dcebb1e13c5a7d8b63dc5b Author: ouyangxiangzhen <[email protected]> AuthorDate: Thu Jan 15 19:38:35 2026 +0800 sched/hrtimer: Simplify the hrtimer_process. This commit simplified the hrtimer_process. Signed-off-by: ouyangxiangzhen <[email protected]> --- sched/hrtimer/hrtimer_process.c | 18 ++++-------------- sched/hrtimer/hrtimer_start.c | 2 +- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/sched/hrtimer/hrtimer_process.c b/sched/hrtimer/hrtimer_process.c index 2b701cd85ae..505084731d4 100644 --- a/sched/hrtimer/hrtimer_process.c +++ b/sched/hrtimer/hrtimer_process.c @@ -85,23 +85,13 @@ void hrtimer_process(uint64_t now) hrtimer = hrtimer_get_first(); - while (hrtimer != NULL) - { - func = hrtimer->func; - - /* Ensure the timer callback is valid */ - - DEBUGASSERT(func != NULL); + /* Check if the timer has expired */ + while (hrtimer != NULL && HRTIMER_TIME_BEFORE_EQ(hrtimer->expired, now)) + { + func = hrtimer->func; expired = hrtimer->expired; - /* Check if the timer has expired */ - - if (!clock_compare(expired, now)) - { - break; - } - /* Remove the expired timer from the timer queue */ hrtimer_remove(hrtimer); diff --git a/sched/hrtimer/hrtimer_start.c b/sched/hrtimer/hrtimer_start.c index 49553583201..73364e3df95 100644 --- a/sched/hrtimer/hrtimer_start.c +++ b/sched/hrtimer/hrtimer_start.c @@ -66,7 +66,7 @@ int hrtimer_start_absolute(FAR hrtimer_t *hrtimer, hrtimer_entry_t func, bool reprogram = false; int ret = OK; - DEBUGASSERT(hrtimer != NULL); + DEBUGASSERT(hrtimer != NULL && func != NULL); /* Acquire the lock and seize the ownership of the hrtimer queue. */
