sched/semaphore: sem_destroy sets semcount to 0

MIRTOS-386

matching the behavior of pthread_barrier_init check

Change-Id: I294df7ffed1d5d35497a8e18d6882d977565bb15
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
This commit is contained in:
Peter Bee
2021-01-28 16:44:48 +08:00
committed by bijunda1
parent 9532a100ff
commit 1f41e8bc0b
+3 -3
View File
@@ -79,7 +79,7 @@ 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.
@@ -87,9 +87,9 @@ int nxsem_destroy (FAR sem_t *sem)
* leave the count unchanged but still return OK.
*/
if (sem->semcount >= 0)
if (sem->semcount > 0)
{
sem->semcount = 1;
sem->semcount = 0;
}
/* Release holders of the semaphore */