Skip to content

Commit

Permalink
sched/tcb: fix 12320 regression
Browse files Browse the repository at this point in the history
This patch attempts to fix regressions reported for pull# 12320.

Signed-off-by: Yanfeng Liu <[email protected]>
  • Loading branch information
yf13 authored and jerpelea committed Jul 17, 2024
1 parent 9790248 commit d98b1a4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions sched/init/nx_bringup.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,11 @@ int nx_bringup(void)

#if !defined(CONFIG_DISABLE_ENVIRON) && (defined(CONFIG_PATH_INITIAL) || \
defined(CONFIG_LDPATH_INITIAL))
/* We an save a few bytes by discarding the IDLE thread's environment. */
/* We would save a few bytes by discarding the IDLE thread's environment.
* But when kthreads share the same group, this is no longer proper, so
* we can't do clearenv() now.
*/

clearenv();
#endif

sched_trace_end();
Expand Down
4 changes: 2 additions & 2 deletions sched/sched/sched_releasetcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ int nxsched_release_tcb(FAR struct tcb_s *tcb, uint8_t ttype)

nxtask_joindestroy(tcb);

/* Kernel thread and group still reference by pthread */
/* Task still referenced by pthread */

if (ttype != TCB_FLAG_TTYPE_PTHREAD)
if (ttype == TCB_FLAG_TTYPE_TASK)
{
ttcb = (FAR struct task_tcb_s *)tcb;
if (!sq_empty(&ttcb->group.tg_members)
Expand Down
6 changes: 5 additions & 1 deletion sched/task/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ void _exit(int status)
* exit through a different mechanism.
*/

group_kill_children(tcb);
if ((tcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL)
{
group_kill_children(tcb);
}

#endif

/* Perform common task termination logic. This will get called again later
Expand Down

0 comments on commit d98b1a4

Please sign in to comment.