xiaoxiang781216 commented on code in PR #15561: URL: https://github.com/apache/nuttx/pull/15561#discussion_r1916193728
########## sched/timer/timer_setitimer.c: ########## @@ -103,14 +108,14 @@ int setitimer(int which, FAR const struct itimerval *value, rtcb = this_task(); - flags = enter_critical_section(); + nxmutex_lock(&g_setitimer_mutex); if (!rtcb->group->itimer) Review Comment: can we use group->lock ########## sched/timer/timer_initialize.c: ########## @@ -136,19 +136,21 @@ void timer_deleteall(pid_t pid) FAR struct posix_timer_s *next; irqstate_t flags; - flags = enter_critical_section(); + flags = spin_lock_irqsave(&g_locktimers); for (timer = (FAR struct posix_timer_s *)g_alloctimers.head; timer != NULL; timer = next) { next = timer->flink; if (timer->pt_owner == pid) { + spin_unlock_irqrestore(&g_locktimers, flags); timer_delete((timer_t)timer); Review Comment: race condition, other thread may delete `next` timer. -- 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: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org