mirror of
https://github.com/apache/nuttx.git
synced 2026-10-04 04:38:10 +00:00
sched/hrtimer: Simplify the hrtimer_process.
This commit simplified the hrtimer_process. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit is contained in:
parent
493e2075a1
commit
33c6b4115c
2 changed files with 5 additions and 15 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue