From 8cfb9d70530f7c86072be1218de3d6fe1b8ab275 Mon Sep 17 00:00:00 2001 From: wangchengdong Date: Fri, 29 Aug 2025 10:34:19 +0800 Subject: [PATCH] libs/libc/semaphore: allow nxsem_init to negative value Allow user to init semaphore value to negative value, this is needed in some use cases --- include/nuttx/semaphore.h | 2 +- libs/libc/semaphore/sem_init.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nuttx/semaphore.h b/include/nuttx/semaphore.h index 3ecd34e3e3..1c28dc9410 100644 --- a/include/nuttx/semaphore.h +++ b/include/nuttx/semaphore.h @@ -147,7 +147,7 @@ extern "C" * ****************************************************************************/ -int nxsem_init(FAR sem_t *sem, int pshared, uint32_t value); +int nxsem_init(FAR sem_t *sem, int pshared, int32_t value); /**************************************************************************** * Name: nxsem_destroy diff --git a/libs/libc/semaphore/sem_init.c b/libs/libc/semaphore/sem_init.c index b37d3a9be5..be0cba9fde 100644 --- a/libs/libc/semaphore/sem_init.c +++ b/libs/libc/semaphore/sem_init.c @@ -62,7 +62,7 @@ * ****************************************************************************/ -int nxsem_init(FAR sem_t *sem, int pshared, uint32_t value) +int nxsem_init(FAR sem_t *sem, int pshared, int32_t value) { UNUSED(pshared);