Fix-Point commented on code in PR #18131:
URL: https://github.com/apache/nuttx/pull/18131#discussion_r2726222995
##########
sched/hrtimer/hrtimer_process.c:
##########
@@ -122,22 +119,18 @@ void hrtimer_process(uint64_t now)
flags = spin_lock_irqsave(&g_hrtimer_spinlock);
-#ifdef CONFIG_SMP
- g_hrtimer_running[cpu] = NULL;
-#endif
-
/* If the timer is periodic and has not been rearmed or
* cancelled concurrently,
* compute next expiration and reinsert into RB-tree
*/
- if (period > 0 && hrtimer->expired == expired)
+ if (period != 0u && hrtimer_is_running(hrtimer, cpu))
{
hrtimer->expired += period;
/* Ensure no overflow occurs */
- DEBUGASSERT(hrtimer->expired > period);
+ DEBUGASSERT(hrtimer->expired >= period);
Review Comment:
But `hrtimer->expired` can be zero, since the hrtimer can be started by
`hrtimer_start(timer, func, arg, 0, HRTIMER_MODE_ABS)`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]