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


##########
sched/task/task_exithook.c:
##########
@@ -174,7 +174,7 @@ static inline void nxtask_sigchild(pid_t ppid, FAR struct 
tcb_s *ctcb,
    * should generate SIGCHLD.
    */
 
-  if (chgrp->tg_nmembers == 1)
+  if (sq_count(&chgrp->tg_members) == 1)

Review Comment:
   too slow, let's add sq_is_singular?



##########
sched/group/group_leave.c:
##########
@@ -226,17 +166,17 @@ void group_leave(FAR struct tcb_s *tcb)
   group = tcb->group;
   if (group)
     {
-      /* Remove the member from group.  This function may be called
-       * during certain error handling before the PID has been
-       * added to the group.  In this case tcb->pid will be uninitialized
-       * group_removemember() will fail.
-       */
+      /* Remove the member from group. */
 
-      group_removemember(group, tcb->pid);
+#ifdef HAVE_GROUP_MEMBERS
+      flags = spin_lock_irqsave_wo_note(NULL);
+      sq_rem(&tcb->member, &group->tg_members);
+      spin_unlock_irqrestore_wo_note(NULL, flags);
 
       /* Have all of the members left the group? */
 
-      if (group->tg_nmembers == 0)
+      if (sq_count(&group->tg_members) == 0)

Review Comment:
   call sq_is_empty



##########
sched/group/group_killchildren.c:
##########
@@ -191,7 +191,7 @@ int group_kill_children(FAR struct tcb_s *tcb)
   ret = CONFIG_GROUP_KILL_CHILDREN_TIMEOUT_MS;
   while (1)
     {
-      if (tcb->group->tg_nmembers <= 1)
+      if (sq_count(&tcb->group->tg_members) <= 1)

Review Comment:
   sq_is_empty



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