jlaitine commented on code in PR #16194: URL: https://github.com/apache/nuttx/pull/16194#discussion_r2062913034
########## sched/semaphore/sem_waitirq.c: ########## @@ -72,30 +72,54 @@ void nxsem_wait_irq(FAR struct tcb_s *wtcb, int errcode) { FAR struct tcb_s *rtcb = this_task(); FAR sem_t *sem = wtcb->waitobj; + const bool mutex = NXSEM_IS_MUTEX(sem); /* It is possible that an interrupt/context switch beat us to the punch * and already changed the task's state. */ - DEBUGASSERT(sem != NULL && atomic_read(NXSEM_COUNT(sem)) < 0); + DEBUGASSERT(sem != NULL && + (mutex || atomic_read(NXSEM_COUNT(sem)) < 0) && + (!mutex || Review Comment: No, would be wrong. This checks " (if it is !mutex, the count must be < 0) AND (if it is mutex, it must be blocking a thread). Your suggestion would lead it to always fail for counting semaphores. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org