casaroli commented on code in PR #21352:
URL: https://github.com/apache/nuttx/pull/21352#discussion_r4444516546
##########
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:
`nxtask_exithook()` calls `group_leave()`, which sets `tcb->group` to NULL
while the TCB stays in the PID hash until `nxsched_release_tcb()`. And all
kernel threads share `g_kthread_group`: when a kernel thread starts another
one, `nxtask_save_parent()` (task_setup.c:273) sets its `tg_ppid` to its own
`tg_pid` (0), so without the second check a kernel thread finds itself as its
own child.
--
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]