You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "xiaoxiang781216 (via GitHub)" <gi...@apache.org> on 2023/01/28 08:26:50 UTC

[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8321: sched/wqueue: semaphore count should be consistent with the number of work entries.

xiaoxiang781216 commented on code in PR #8321:
URL: https://github.com/apache/nuttx/pull/8321#discussion_r1089682358


##########
sched/semaphore/sem_post.c:
##########
@@ -89,7 +89,11 @@ int nxsem_post(FAR sem_t *sem)
 
   /* Check the maximum allowable value */
 
-  DEBUGASSERT(sem_count < SEM_VALUE_MAX);
+  if (sem_count >= SEM_VALUE_MAX)
+    {
+      leave_critical_section(flags);
+      return -EOVERFLOW;

Review Comment:
   I am wondering that whether the implementation can just allow to return the error code specified by spec or have some flexibility to return some additional error to report the implementation detail. For example, most sem_t implementation has at least 32bit count which is very hard to hit the overflow issue, but NuttX use 16bit count and then hit this problem more frequenctly than others.



-- 
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-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org