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


##########
sched/semaphore/sem_holder.c:
##########
@@ -891,6 +789,8 @@ void nxsem_restore_baseprio(FAR struct tcb_s *stcb, FAR 
sem_t *sem)
               (sem->semcount <= 0 && stcb != NULL));
 #endif
 
+  DEBUGASSERT(!up_interrupt_context());

Review Comment:
   why can't be called from the interrupt context?



##########
sched/semaphore/sem_holder.c:
##########
@@ -792,61 +697,54 @@ void nxsem_boost_priority(FAR sem_t *sem)
 void nxsem_release_holder(FAR sem_t *sem)
 {
   FAR struct tcb_s *rtcb = this_task();
-  FAR struct semholder_s *pholder;
-  FAR struct semholder_s *candidate = NULL;
-  unsigned int total = 0;
+  uint8_t prioinherit = sem->flags & SEM_PRIO_MASK;
+
+  /* If priority inheritance is disabled for this thread or it is IDLE
+   * thread, then do not add the holder.
+   * If there are never holders of the semaphore, the priority
+   * inheritance is effectively disabled.
+   */
+
+  if (!is_idle_task(rtcb) && prioinherit == SEM_PRIO_INHERIT)

Review Comment:
   why skip in the idle task?



##########
sched/semaphore/sem_holder.c:
##########
@@ -792,61 +697,54 @@ void nxsem_boost_priority(FAR sem_t *sem)
 void nxsem_release_holder(FAR sem_t *sem)
 {
   FAR struct tcb_s *rtcb = this_task();
-  FAR struct semholder_s *pholder;
-  FAR struct semholder_s *candidate = NULL;
-  unsigned int total = 0;
+  uint8_t prioinherit = sem->flags & SEM_PRIO_MASK;
+
+  /* If priority inheritance is disabled for this thread or it is IDLE
+   * thread, then do not add the holder.
+   * If there are never holders of the semaphore, the priority
+   * inheritance is effectively disabled.
+   */
+
+  if (!is_idle_task(rtcb) && prioinherit == SEM_PRIO_INHERIT)
+    {
+      FAR struct semholder_s *pholder;
 
-  /* Find the container for this holder */
+      DEBUGASSERT(!up_interrupt_context());

Review Comment:
   ditto



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

Reply via email to