sched/task/task_create.c: Correct logic in error handling
After nxtask_setup_arguments() is called, the task must be removed from the active task list in order to properly recover from any error condition.
This commit is contained in:
parent
2aa1f5c765
commit
d2f10e7386
|
@ -136,7 +136,7 @@ static int nxthread_create(FAR const char *name, uint8_t ttype,
|
|||
ret = group_initialize(tcb);
|
||||
if (ret < 0)
|
||||
{
|
||||
goto errout_with_tcb;
|
||||
goto errout_with_active;
|
||||
}
|
||||
|
||||
/* Get the assigned pid before we start the task */
|
||||
|
@ -148,16 +148,18 @@ static int nxthread_create(FAR const char *name, uint8_t ttype,
|
|||
ret = nxtask_activate((FAR struct tcb_s *)tcb);
|
||||
if (ret < OK)
|
||||
{
|
||||
/* The TCB was added to the active task list by
|
||||
* nxtask_setup_scheduler()
|
||||
*/
|
||||
|
||||
dq_rem((FAR dq_entry_t *)tcb, (FAR dq_queue_t *)&g_inactivetasks);
|
||||
goto errout_with_tcb;
|
||||
goto errout_with_active;
|
||||
}
|
||||
|
||||
return pid;
|
||||
|
||||
errout_with_active:
|
||||
/* The TCB was added to the inactive task list by
|
||||
* nxtask_setup_scheduler().
|
||||
*/
|
||||
|
||||
dq_rem((FAR dq_entry_t *)tcb, (FAR dq_queue_t *)&g_inactivetasks);
|
||||
|
||||
errout_with_tcb:
|
||||
nxsched_release_tcb((FAR struct tcb_s *)tcb, ttype);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue