mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
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:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user