davids5 commented on code in PR #8743: URL: https://github.com/apache/nuttx/pull/8743#discussion_r1175095716
########## include/semaphore.h: ########## @@ -113,7 +113,7 @@ struct sem_s # if CONFIG_SEM_PREALLOCHOLDERS > 0 FAR struct semholder_s *hhead; /* List of holders of semaphore counts */ # else - struct semholder_s holder[2]; /* Slot for old and new holder */ + struct semholder_s holder; /* Slot for old and new holder */ Review Comment: @zyfeier There has been a lot of resent changes to the priority restoration done by @pkarashchenko and the concern I have may have been resolved. But here is the [commit I was referring too](https://github.com/apache/nuttx/commit/360539afacc83132acdb83da8f20c468dbe4c63d) It was an order of operation that required the change. Priority inheritance: When CONFIG_SEM_PREALLOCHOLDERS==0, there is only a single, hard-allocated holder structure. This is problem because in sem_wait() the holder is released, but needs to remain in the holder container until sem_restorebaseprio() is called. The call to sem_restorebaseprio() must be one of the last things the sem_wait() does because it can cause the task to be suspended. If in sem_wait(), a new task gets the semaphore count then it will fail to allocate the holder and will not participate in priority inheritance. This fix is to add two hard-allocated holders in the sem_t structure: One of the old holder and one for the new holder. -- 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