kernel: work_q: Fix k_work_queue_start documentation

Inform that the queue has to be initialized in zeroed memory or with
the k_work_queue_init before use.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2021-08-23 15:04:58 -07:00 committed by Anas Nashif
commit c42cde5b69
2 changed files with 10 additions and 4 deletions

View file

@ -222,9 +222,11 @@ Defining and Controlling a Workqueue
====================================
A workqueue is defined using a variable of type :c:struct:`k_work_q`.
The workqueue is initialized by defining the stack area used by its thread
and then calling :c:func:`k_work_queue_start`. The stack area must be defined
using :c:macro:`K_THREAD_STACK_DEFINE` to ensure it is properly set up in
The workqueue is initialized by defining the stack area used by its
thread, initializing the :c:struct:`k_work_q`, either zeroing its
memory or calling :c:func:`k_work_queue_init`, and then calling
:c:func:`k_work_queue_start`. The stack area must be defined using
:c:macro:`K_THREAD_STACK_DEFINE` to ensure it is properly set up in
memory.
The following code defines and initializes a workqueue:
@ -238,6 +240,8 @@ The following code defines and initializes a workqueue:
struct k_work_q my_work_q;
k_work_queue_init(&my_work_q);
k_work_queue_start(&my_work_q, my_stack_area,
K_THREAD_STACK_SIZEOF(my_stack_area), MY_PRIORITY,
NULL);

View file

@ -3061,7 +3061,9 @@ void k_work_queue_init(struct k_work_q *queue);
* This configures the work queue thread and starts it running. The function
* should not be re-invoked on a queue.
*
* @param queue pointer to the queue structure.
* @param queue pointer to the queue structure. It must be initialized
* in zeroed/bss memory or with @ref k_work_queue_init before
* use.
*
* @param stack pointer to the work thread stack area.
*