This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push: new 634bdeaa5c pthread_barrier:don't destory when barrier used 634bdeaa5c is described below commit 634bdeaa5c59c38a6d6b030b5c2a2945dab8711e Author: anjiahao <anjia...@xiaomi.com> AuthorDate: Wed Nov 9 17:13:10 2022 +0800 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 <anjia...@xiaomi.com> --- libs/libc/pthread/pthread_barrierdestroy.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libs/libc/pthread/pthread_barrierdestroy.c b/libs/libc/pthread/pthread_barrierdestroy.c index 03bd2d9900..11625f5c4c 100644 --- a/libs/libc/pthread/pthread_barrierdestroy.c +++ b/libs/libc/pthread/pthread_barrierdestroy.c @@ -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; }