diff --git a/sched/task/task_exithook.c b/sched/task/task_exithook.c index 9b9477c0f32..bc300ec856c 100644 --- a/sched/task/task_exithook.c +++ b/sched/task/task_exithook.c @@ -191,6 +191,7 @@ static inline void nxtask_exitstatus(FAR struct task_group_s *group, int status) { FAR struct child_status_s *child; + FAR struct tcb_s *rtcb = this_task(); /* Check if the parent task group has suppressed retention of * child exit status information. @@ -200,7 +201,7 @@ static inline void nxtask_exitstatus(FAR struct task_group_s *group, { /* No.. Find the exit status entry for this task in the parent TCB */ - child = group_find_child(group, getpid()); + child = group_find_child(group, rtcb->group->tg_task); if (child) { /* Save the exit status.. For the case of HAVE_GROUP_MEMBERS, @@ -230,6 +231,7 @@ static inline void nxtask_exitstatus(FAR struct task_group_s *group, static inline void nxtask_groupexit(FAR struct task_group_s *group) { FAR struct child_status_s *child; + FAR struct tcb_s *rtcb = this_task(); /* Check if the parent task group has suppressed retention of child exit * status information. @@ -239,7 +241,7 @@ static inline void nxtask_groupexit(FAR struct task_group_s *group) { /* No.. Find the exit status entry for this task in the parent TCB */ - child = group_find_child(group, getpid()); + child = group_find_child(group, rtcb->group->tg_task); if (child) { /* Mark that all members of the child task group has exited */