mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 14:58:13 +08:00
sched/hrtimer: Simplify the hrtimer.
This commit simplified the hrtimer. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit is contained in:
committed by
Donny(董九柱)
parent
dac48484ce
commit
b685d97199
@@ -81,15 +81,20 @@ void hrtimer_process(uint64_t now)
|
||||
|
||||
flags = write_seqlock_irqsave(&g_hrtimer_lock);
|
||||
|
||||
/* Fetch the earliest active timer */
|
||||
|
||||
hrtimer = hrtimer_get_first();
|
||||
expired = hrtimer->expired;
|
||||
|
||||
/* Check if the timer has expired */
|
||||
|
||||
while (HRTIMER_TIME_BEFORE_EQ(expired, now))
|
||||
for (; ; )
|
||||
{
|
||||
/* Fetch the earliest active timer */
|
||||
|
||||
hrtimer = hrtimer_get_first();
|
||||
expired = hrtimer->expired;
|
||||
|
||||
/* Check if the timer has expired */
|
||||
|
||||
if (!HRTIMER_TIME_BEFORE_EQ(expired, now))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
||||
Reference in New Issue
Block a user