diff --git a/sched/task/task_exithook.c b/sched/task/task_exithook.c index dd43c4b40d1..fbb3bd055c4 100644 --- a/sched/task/task_exithook.c +++ b/sched/task/task_exithook.c @@ -448,6 +448,12 @@ void nxtask_exithook(FAR struct tcb_s *tcb, int status) irqstate_t flags = enter_critical_section(); #endif + /* Disable the scheduling function to prevent other tasks from + * being deleted after they are awakened + */ + + sched_lock(); + /* Send the SIGCHLD signal to the parent task group */ nxtask_signalparent(tcb, status); @@ -456,6 +462,8 @@ void nxtask_exithook(FAR struct tcb_s *tcb, int status) nxtask_exitwakeup(tcb, status); + sched_unlock(); + /* Leave the task group. Perhaps discarding any un-reaped child * status (no zombies here!) */