patacongo edited a comment on pull request #1099:
URL: https://github.com/apache/incubator-nuttx/pull/1099#issuecomment-634607385
> 255 /* Then activate the task at the provided priority */
> 256
> 257 ret = task_activate((FAR struct tcb_s *)tcb);
> 258 if (ret < 0)
> 259 {
> _kmm_free(tcb);_
> kumm_free(stack);
> return ret;
> 262 }
There is an error in that. After task_init() is called, `sched_releasetcb()
`should be called to free the TCB. In addition, the TCB needs to be removed
from the active task list. The correct error handling for this case is as in
`thread_create()`:
146 /* Activate the task */
147
148 ret = nxtask_activate((FAR struct tcb_s *)tcb);
149 if (ret < OK)
150 {
151 /* The TCB was added to the active task list by
152 * nxtask_setup_scheduler()
153 */
154
155 dq_rem((FAR dq_entry_t *)tcb, (FAR dq_queue_t
*)&g_inactivetasks);
156 goto errout_with_tcb;
157 }
158
159 return pid;
160
161 errout_with_tcb:
162 nxsched_release_tcb((FAR struct tcb_s *)tcb, ttype);
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]