pthread_barrier:don't destory when barrier used

this is fix a ltp test case and update
the error code of pthread_barrierdestroy

ltptcase is : apps/testing/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_destroy/2-1.c
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2022-11-09 17:13:10 +08:00 committed by Xiang Xiao
parent a9c647d418
commit 634bdeaa5c
1 changed files with 12 additions and 0 deletions

View File

@ -61,6 +61,7 @@
int pthread_barrier_destroy(FAR pthread_barrier_t *barrier)
{
int semcount;
int ret = OK;
if (!barrier)
@ -69,6 +70,17 @@ int pthread_barrier_destroy(FAR pthread_barrier_t *barrier)
}
else
{
ret = sem_getvalue(&barrier->sem, &semcount);
if (ret != OK)
{
return ret;
}
if (semcount < 0)
{
return EBUSY;
}
sem_destroy(&barrier->sem);
barrier->count = 0;
}