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/06 15:20:46 UTC

[GitHub] [incubator-nuttx] pussuw commented on a diff in pull request #6215: sched/group: addrenv: allocate g_pid_current for each cpu

pussuw commented on code in PR #6215:
URL: https://github.com/apache/incubator-nuttx/pull/6215#discussion_r866932827


##########
sched/group/group_addrenv.c:
##########
@@ -119,15 +146,15 @@ int group_addrenv(FAR struct tcb_s *tcb)
   /* Are we going to change address environments? */
 
   flags = enter_critical_section();
-  if (pid != g_pid_current)
+  if (pid != g_pid_current[cpu])

Review Comment:
   Suggestion:
   Implement a getter for g_pid_current[this_cpu] and store its value upon entry.
   
   Something like this:
   
   int get_pid_current(void)
   {
     int pid = g_pid_current[cpu];
     return pid == IDLE_PROCESS_ID ? INVALID_PROCESS_ID : pid;
   }
   
   This way you don't need to initialize the struct



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