Re: [PR] Fix the SMP acquire/release pattern in nxsem [nuttx]

2025-04-13 Thread via GitHub


jlaitine closed pull request #16197: Fix the SMP acquire/release pattern in 
nxsem
URL: https://github.com/apache/nuttx/pull/16197


-- 
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]



Re: [PR] Fix the SMP acquire/release pattern in nxsem [nuttx]

2025-04-13 Thread via GitHub


jlaitine commented on code in PR #16197:
URL: https://github.com/apache/nuttx/pull/16197#discussion_r2041179698


##
sched/semaphore/sem_destroy.c:
##
@@ -74,9 +74,9 @@ int nxsem_destroy(FAR sem_t *sem)
* leave the count unchanged but still return OK.
*/
 
-  old = atomic_read(NXSEM_COUNT(sem));
   do
 {
+  old = atomic_read(NXSEM_COUNT(sem));

Review Comment:
   ah shoot. you are right. closing this.



-- 
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]



Re: [PR] Fix the SMP acquire/release pattern in nxsem [nuttx]

2025-04-13 Thread via GitHub


xiaoxiang781216 commented on code in PR #16197:
URL: https://github.com/apache/nuttx/pull/16197#discussion_r2041152859


##
sched/semaphore/sem_destroy.c:
##
@@ -74,9 +74,9 @@ int nxsem_destroy(FAR sem_t *sem)
* leave the count unchanged but still return OK.
*/
 
-  old = atomic_read(NXSEM_COUNT(sem));
   do
 {
+  old = atomic_read(NXSEM_COUNT(sem));

Review Comment:
   but atomic_try_cmpxchg_release at line 85 will update old to the latest 
value, why do we need reread it here?



-- 
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]