anchao commented on code in PR #13129:
URL: https://github.com/apache/nuttx/pull/13129#discussion_r1736212256


##########
sched/task/task_setup.c:
##########
@@ -170,6 +170,16 @@ static int nxtask_assign_pid(FAR struct tcb_s *tcb)
 
   for (i = 0; i < g_npidhash / 2; i++)
     {
+      if (g_pidhash[i] == NULL)
+        {
+          /* If the pid is not used, skip it.
+           * This may be triggered when a context switch occurs
+           * during mm_malloc and a thread is destroyed.
+           */

Review Comment:
   >This is already in the critical section, no thread switch will occur 
causing pid to be assigned
   
   as you mentioned, **already in the critical section, no thread switch will 
occur causing pid to be assigned**
   so why needs to check NULL here? 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to