sched/tcb: fix 12320 regression

This patch attempts to fix regressions reported for pull# 12320.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
This commit is contained in:
Yanfeng Liu 2024-06-25 16:36:13 +08:00 committed by Xiang Xiao
parent e01fb50541
commit c8f18767de
3 changed files with 11 additions and 5 deletions

View file

@ -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();

View file

@ -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)

View file

@ -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