yamt commented on code in PR #14465: URL: https://github.com/apache/nuttx/pull/14465#discussion_r1839502661
########## sched/semaphore/sem_post.c: ########## @@ -78,21 +78,20 @@ int nxsem_post(FAR sem_t *sem) uint8_t proto; #endif - DEBUGASSERT(sem != NULL); - /* The following operations must be performed with interrupts * disabled because sem_post() may be called from an interrupt * handler. */ flags = enter_critical_section(); - sem_count = sem->semcount; + sem_count = atomic_fetch_add(NXSEM_COUNT(sem), 1); /* Check the maximum allowable value */ if (sem_count >= SEM_VALUE_MAX) { Review Comment: i guess it's safer to use compare xchg. -- 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