You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/07/09 14:47:34 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #4105: sched/semaphore: sem_destroy sets semcount to 0

xiaoxiang781216 opened a new pull request #4105:
URL: https://github.com/apache/incubator-nuttx/pull/4105


   ## Summary
   matching the behavior of pthread_barrier_init check
   
   ## Impact
   
   ## Testing
   
   


-- 
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-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 closed pull request #4105: sched/semaphore: sem_destroy sets semcount to 0

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 closed pull request #4105:
URL: https://github.com/apache/incubator-nuttx/pull/4105


   


-- 
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-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #4105: sched/semaphore: sem_destroy sets semcount to 0

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #4105:
URL: https://github.com/apache/incubator-nuttx/pull/4105#discussion_r668420189



##########
File path: sched/semaphore/sem_destroy.c
##########
@@ -64,17 +64,17 @@ int nxsem_destroy (FAR sem_t *sem)
     {
       /* There is really no particular action that we need
        * take to destroy a semaphore.  We will just reset
-       * the count to some reasonable value (1) and release
+       * the count to some reasonable value (0) and release
        * ownership.
        *
        * Check if other threads are waiting on the semaphore.
        * In this case, the behavior is undefined.  We will:
        * leave the count unchanged but still return OK.
        */
 
-      if (sem->semcount >= 0)
+      if (sem->semcount > 0)
         {
-          sem->semcount = 1;
+          sem->semcount = 0;

Review comment:
       This PR is related to https://github.com/apache/incubator-nuttx/pull/4129. Let's merge it into one patch, so you can get more sense.




-- 
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-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #4105: sched/semaphore: sem_destroy sets semcount to 0

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4105:
URL: https://github.com/apache/incubator-nuttx/pull/4105#discussion_r667931972



##########
File path: sched/semaphore/sem_destroy.c
##########
@@ -64,17 +64,17 @@ int nxsem_destroy (FAR sem_t *sem)
     {
       /* There is really no particular action that we need
        * take to destroy a semaphore.  We will just reset
-       * the count to some reasonable value (1) and release
+       * the count to some reasonable value (0) and release
        * ownership.
        *
        * Check if other threads are waiting on the semaphore.
        * In this case, the behavior is undefined.  We will:
        * leave the count unchanged but still return OK.
        */
 
-      if (sem->semcount >= 0)
+      if (sem->semcount > 0)
         {
-          sem->semcount = 1;
+          sem->semcount = 0;

Review comment:
       I don't have the background for why `semcount` was being set to 1, so I am afraid to simply approve it.




-- 
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-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org