anchao commented on code in PR #15324: URL: https://github.com/apache/nuttx/pull/15324#discussion_r1897028140
########## sched/clock/clock_gettime.c: ########## @@ -58,15 +58,15 @@ static clock_t clock_process_runtime(FAR struct tcb_s *tcb) group = tcb->group; - flags = spin_lock_irqsave(NULL); + flags = spin_lock_irqsave(&group->lock); sq_for_every(&group->tg_members, curr) { tcb = container_of(curr, struct tcb_s, member); runtime += tcb->run_time; } - spin_unlock_irqrestore(NULL, flags); + spin_unlock_irqrestore(&group->lock, flags); Review Comment: The code snippet you see is only protecting a specific resource, and fine-grained locks are worth it in this scenario because they avoid competing with other resources, and, spinlock does not take up too many memory. It is just a specific native prototype. -- 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