xiaoxiang781216 commented on code in PR #21352:
URL: https://github.com/apache/nuttx/pull/21352#discussion_r4442646431
##########
sched/sched/sched_waitid.c:
##########
@@ -130,20 +133,27 @@ int waittcb(FAR struct tcb_s *rtcb, idtype_t idtype, int
options,
exited_child(rtcb, child, info, options);
break;
}
+
+ /* Without an exit status to wait for (XSI), wait until all
+ * children exit
+ */
+
+ if ((!retains || rtcb->group->tg_children == NULL) &&
+ !group_has_child(rtcb->group, INVALID_PROCESS_ID))
+ {
+ errcode = ECHILD;
+ break;
+ }
}
/* We are waiting for a specific PID. Does this task retain child
* status?
*/
- else if (retains)
+ else if (retains &&
+ (child = group_find_child(rtcb->group, (pid_t)id)) != NULL)
Review Comment:
remove the cast
##########
sched/group/group_childstatus.c:
##########
@@ -107,6 +116,28 @@ static void group_dump_children(FAR struct task_group_s
*group,
# define group_dump_children(t,m)
#endif
+/****************************************************************************
+ * Name: group_child_handler
+ *
+ * Description:
+ * The nxsched_foreach() handler of group_has_child().
+ *
+ ****************************************************************************/
+
+static void group_child_handler(FAR struct tcb_s *tcb, FAR void *arg)
+{
+ FAR struct child_search_s *search = arg;
+ FAR struct task_group_s *group = tcb->group;
+
+ if (group != NULL && group != search->group &&
Review Comment:
why need `group != NULL && group != search->group `
##########
sched/sched/sched_waitid.c:
##########
@@ -155,22 +165,14 @@ int waittcb(FAR struct tcb_s *rtcb, idtype_t idtype, int
options,
break;
}
}
- else
+ else if (!group_has_child(rtcb->group, (pid_t)id))
Review Comment:
remove the cast too
--
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]