diff --git a/libs/libc/pthread/pthread_conddestroy.c b/libs/libc/pthread/pthread_conddestroy.c index c27c63be01b..cd69d419a43 100644 --- a/libs/libc/pthread/pthread_conddestroy.c +++ b/libs/libc/pthread/pthread_conddestroy.c @@ -69,21 +69,18 @@ int pthread_cond_destroy(FAR pthread_cond_t *cond) else { - ret = sem_getvalue(&cond->sem, &sval); + ret = nxsem_get_value(&cond->sem, &sval); if (ret < 0) { ret = -ret; } + else if (sval < 0) + { + ret = EBUSY; + } else { - if (sval < 0) - { - ret = EBUSY; - } - else if (sem_destroy(&cond->sem) != OK) - { - ret = get_errno(); - } + ret = -nxsem_destroy(&cond->sem); } }