libs/libc/semaphore: Fix DEBUGASSERTS

The DEBUGASSERTS in nxsem_wait and nxsem_trywait were non-functional, they
didn't check anything.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
Jukka Laitinen
2025-04-09 12:59:21 +03:00
committed by Xiang Xiao
parent 1e8977c079
commit 300992203a
2 changed files with 6 additions and 8 deletions
+3 -4
View File
@@ -106,13 +106,12 @@ int sem_trywait(FAR sem_t *sem)
int nxsem_trywait(FAR sem_t *sem)
{
DEBUGASSERT(sem != NULL);
/* This API should not be called from the idleloop or interrupt */
#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask() ||
up_interrupt_context());
DEBUGASSERT(sem != NULL);
DEBUGASSERT(!up_interrupt_context());
DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask());
#endif
/* We don't do atomic fast path in case of LIBC_ARCH_ATOMIC because that
+3 -4
View File
@@ -134,13 +134,12 @@ errout_with_cancelpt:
int nxsem_wait(FAR sem_t *sem)
{
DEBUGASSERT(sem != NULL);
/* This API should not be called from the idleloop or interrupt */
#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask() ||
up_interrupt_context());
DEBUGASSERT(sem != NULL);
DEBUGASSERT(!up_interrupt_context());
DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask());
#endif
/* We don't do atomic fast path in case of LIBC_ARCH_ATOMIC because that