hujun260 commented on code in PR #18199:
URL: https://github.com/apache/nuttx/pull/18199#discussion_r2739373687
##########
sched/semaphore/sem_clockwait.c:
##########
@@ -137,14 +137,14 @@ int nxsem_clockwait(FAR sem_t *sem, clockid_t clockid,
ret = nxsem_wait(sem);
+ leave_critical_section(flags);
Review Comment:
Generally speaking, the smaller the critical section protection range, the
better.
1 On single-core systems, this improves real-time performance.
2 On multi-core systems, this enhances concurrency and reduces the
likelihood of deadlocks caused by nested locks.
3 Regarding the additional timer callback you mentioned,
this is actually a rare edge case requiring multiple specific conditions to
be met.
It is therefore not appropriate to handle it by enlarging the critical
section.
--
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]