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


##########
fs/procfs/fs_procfsproc.c:
##########
@@ -1202,10 +1205,12 @@ static ssize_t proc_groupstatus(FAR struct proc_file_s 
*procfile,
       return totalsize;
     }
 
-  for (i = 0; i < group->tg_nmembers; i++)
+  sq_for_every_safe(&group->tg_members, curr, next)
     {
+      FAR struct tcb_s *mtcb =

Review Comment:
   Done



##########
sched/clock/clock_gettime.c:
##########
@@ -183,20 +188,24 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
 
       if (tcb != NULL)
         {
+# ifdef HAVE_GROUP_MEMBERS
           group = tcb->group;
           runtime = 0;
 
-          flags = enter_critical_section();
-          for (i = group->tg_nmembers - 1; i >= 0; i--)
+          flags = spin_lock_irqsave_wo_note(NULL);
+          sq_for_every_safe(&group->tg_members, curr, next)
             {
-              tcb = nxsched_get_tcb(group->tg_members[i]);
-              if (tcb != NULL)
-                {
-                  runtime += tcb->run_time;
-                }
+              FAR struct tcb_s *mtcb =

Review Comment:
   Done



##########
sched/clock/clock_gettime.c:
##########
@@ -183,20 +188,24 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
 
       if (tcb != NULL)
         {
+# ifdef HAVE_GROUP_MEMBERS
           group = tcb->group;
           runtime = 0;
 
-          flags = enter_critical_section();
-          for (i = group->tg_nmembers - 1; i >= 0; i--)
+          flags = spin_lock_irqsave_wo_note(NULL);

Review Comment:
   Done



##########
sched/group/group_foreachchild.c:
##########
@@ -58,23 +60,27 @@
 int group_foreachchild(FAR struct task_group_s *group,
                        foreachchild_t handler, FAR void *arg)
 {
+  FAR sq_entry_t *curr;
+  FAR sq_entry_t *next;
   int ret;
-  int i;
 
   DEBUGASSERT(group);
 
   /* Visit the main thread last (if present) */
 
-  for (i = group->tg_nmembers - 1; i >= 0; i--)
+  sq_for_every_safe(&group->tg_members, curr, next)
     {
-      ret = handler(group->tg_members[i], arg);
-      if (ret != 0)
+      FAR struct tcb_s *mtcb =

Review Comment:
   Done



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