sched/task/task_init.c: Add nxtask_uninit()

Add trivial function nxtask_uninit().  This function will undo all operations on a TCB performed by task_init() and release the TCB by calling kmm_free().  This is intended primarily to support error recovery operations after a successful call to task_init() such was when a subsequent call to task_activate fails.

That error recovery is trivial but not obvious.  This helper function should eliminate confusion about what to do to recover after calling nxtask_init()
This commit is contained in:
Gregory Nutt
2020-05-27 09:32:14 -06:00
committed by Abdelatif Guettouche
parent d2f10e7386
commit b9042f5900
2 changed files with 59 additions and 2 deletions
+21
View File
@@ -944,6 +944,27 @@ int nxtask_init(FAR struct tcb_s *tcb, const char *name, int priority,
FAR uint32_t *stack, uint32_t stack_size, main_t entry,
FAR char * const argv[]);
/********************************************************************************
* Name: nxtask_uninit
*
* Description:
* Undo all operations on a TCB performed by task_init() and release the
* TCB by calling kmm_free(). This is intended primarily to support
* error recovery operations after a successful call to task_init() such
* was when a subsequent call to task_activate fails.
*
* Caution: Freeing of the TCB itself might be an unexpected side-effect.
*
* Input Parameters:
* tcb - Address of the TCB initialized by task_init()
*
* Returned Value:
* OK on success; negative error value on failure appropriately.
*
********************************************************************************/
void nxtask_uninit(FAR struct tcb_s *tcb);
/********************************************************************************
* Name: nxtask_activate
*