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/12 20:04:49 UTC

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

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