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

[GitHub] [nuttx] patacongo commented on pull request #9741: iob_alloc: change sem_post to count++

patacongo commented on PR #9741:
URL: https://github.com/apache/nuttx/pull/9741#issuecomment-1627318043

   Incrementing the semaphore count is equivalent to calling `sem_post()`, provided that:
   
   1. The increment is performed within a critical section (it is), and
   2. The count before incrementing is >= 0.  Is it????
   
   A count less than zero means that there are other threads waiting for an IOB.  Calling `sem_post()` when the count is less than zero does additional things:
   
   1. It will unblock the highest priority waiting thread, and
   2. It will execute priority inheritance logic to restore the priority of threads holding a count
   
   If `sem_post()` is replaced with an increment of the count, then this functionality will not be performed.  Is it needed?


-- 
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