You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/05/26 10:58:35 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6328: sched: Move the call of pthread_mutex_inconsistent to nxtask_recover

xiaoxiang781216 commented on code in PR #6328:
URL: https://github.com/apache/incubator-nuttx/pull/6328#discussion_r882553752


##########
sched/task/exit.c:
##########
@@ -68,12 +67,6 @@ void _exit(int status)
   group_kill_children(tcb);
 #endif
 
-#if !defined(CONFIG_DISABLE_PTHREAD) && !defined(CONFIG_PTHREAD_MUTEX_UNSAFE)

Review Comment:
   TCB_FLAG_EXIT_PROCESSING is only set at the end of this function:
   ```
   void nxtask_exithook(FAR struct tcb_s *tcb, int status, bool nonblocking)
   {
     /* Under certain conditions, nxtask_exithook() can be called multiple
      * times.  A bit in the TCB was set the first time this function was
      * called.  If that bit is set, then just exit doing nothing more..
      */
   
     if ((tcb->flags & TCB_FLAG_EXIT_PROCESSING) != 0)
       {
         return;
       }
   
     /* If the task was terminated by another task, it may be in an unknown
      * state.  Make some feeble effort to recover the state.
      */
   
     nxtask_recover(tcb);
   
     /* This function can be re-entered in certain cases.  Set a flag
      * bit in the TCB to not that we have already completed this exit
      * processing.
      */
   
     tcb->flags |= TCB_FLAG_EXIT_PROCESSING;
   }
   ```
   which ensure that nxtask_recover is executed only once.



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