Skip to content

Commit

Permalink
sched/group/group_killchildren.c: Force-cancel children if parent is …
Browse files Browse the repository at this point in the history
…force-cancelled

There is no point in waiting for children to exit if the parent is force-cancelled

Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine committed Mar 21, 2024
1 parent 34fa847 commit e4d95ee
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions sched/group/group_killchildren.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,29 +181,33 @@ int group_kill_children(FAR struct tcb_s *tcb)

#if defined(CONFIG_GROUP_KILL_CHILDREN_TIMEOUT_MS) && \
CONFIG_GROUP_KILL_CHILDREN_TIMEOUT_MS != 0
/* Send SIGTERM for each first */

group_foreachchild(tcb->group, group_kill_children_handler,
(FAR void *)((uintptr_t)tcb->pid));
if ((tcb->flags & TCB_FLAG_FORCED_CANCEL) == 0)
{
/* Send SIGTERM for each first */

/* Wait a bit for child exit */
group_foreachchild(tcb->group, group_kill_children_handler,
(FAR void *)((uintptr_t)tcb->pid));

ret = CONFIG_GROUP_KILL_CHILDREN_TIMEOUT_MS;
while (1)
{
if (tcb->group->tg_nmembers <= 1)
/* Wait a bit for child exit */

ret = CONFIG_GROUP_KILL_CHILDREN_TIMEOUT_MS;
while (1)
{
break;
}
if (tcb->group->tg_nmembers <= 1)
{
break;
}

nxsig_usleep(USEC_PER_MSEC);
nxsig_usleep(USEC_PER_MSEC);

# if CONFIG_GROUP_KILL_CHILDREN_TIMEOUT_MS > 0
if (--ret < 0)
{
break;
}
if (--ret < 0)
{
break;
}
# endif
}
}
#endif

Expand Down

0 comments on commit e4d95ee

Please sign in to comment.