sched/hrtimer: Simplify the hrtimer_process.

This commit simplified the hrtimer_process.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit is contained in:
ouyangxiangzhen 2026-01-15 19:38:35 +08:00 • committed by Donny(董九柱)
parent 493e2075a1
commit 33c6b4115c
2 changed files with 5 additions and 15 deletions

View file

@ -85,23 +85,13 @@ void hrtimer_process(uint64_t now)
hrtimer = hrtimer_get_first();
while (hrtimer != NULL)
/* Check if the timer has expired */
while (hrtimer != NULL && HRTIMER_TIME_BEFORE_EQ(hrtimer->expired, now))
{
func = hrtimer->func;
/* Ensure the timer callback is valid */
DEBUGASSERT(func != NULL);
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);

View file

@ -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. */