From 70640ec673588435ed89649ed318bea29425f572 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Fri, 30 Apr 2021 09:42:05 -0400 Subject: [PATCH] Fix #545, update OS_TaskCreate doc Clarify use of the stack_size parameter, and that it should not be 0. --- src/os/inc/osapi-task.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/os/inc/osapi-task.h b/src/os/inc/osapi-task.h index 6437f8f0f..5bf165bc4 100644 --- a/src/os/inc/osapi-task.h +++ b/src/os/inc/osapi-task.h @@ -81,12 +81,22 @@ typedef osal_task((*osal_task_entry)(void)); /**< @brief For task entry point */ * Creates a task and passes back the id of the task created. Task names must be unique; * if the name already exists this function fails. Names cannot be NULL. * + * Portable applications should always specify the actual stack size in the + * stack_size parameter, not 0. This size value is not enforced/checked by OSAL, + * but is simply passed through to the RTOS for stack creation. Some RTOS + * implementations may assume 0 means a default stack size while others + * may actually create a task with no stack. + * + * Unlike stack_size, the stack_pointer is optional and can be specified as NULL. + * In that case, a stack of the requested size will be dynamically allocated from + * the system heap. + * * @param[out] task_id will be set to the non-zero ID of the newly-created resource * @param[in] task_name the name of the new resource to create * @param[in] function_pointer the entry point of the new task * @param[in] stack_pointer pointer to the stack for the task, or NULL * to allocate a stack from the system memory heap - * @param[in] stack_size the size of the stack, or 0 to use a default stack size. + * @param[in] stack_size the size of the stack * @param[in] priority initial priority of the new task * @param[in] flags initial options for the new task *