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:
parent
d9aa414831
commit
c42cde5b69
2 changed files with 10 additions and 4 deletions
|
@ -222,9 +222,11 @@ Defining and Controlling a Workqueue
|
||||||
====================================
|
====================================
|
||||||
|
|
||||||
A workqueue is defined using a variable of type :c:struct:`k_work_q`.
|
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
|
The workqueue is initialized by defining the stack area used by its
|
||||||
and then calling :c:func:`k_work_queue_start`. The stack area must be defined
|
thread, initializing the :c:struct:`k_work_q`, either zeroing its
|
||||||
using :c:macro:`K_THREAD_STACK_DEFINE` to ensure it is properly set up in
|
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.
|
memory.
|
||||||
|
|
||||||
The following code defines and initializes a workqueue:
|
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;
|
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_work_queue_start(&my_work_q, my_stack_area,
|
||||||
K_THREAD_STACK_SIZEOF(my_stack_area), MY_PRIORITY,
|
K_THREAD_STACK_SIZEOF(my_stack_area), MY_PRIORITY,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
|
@ -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
|
* This configures the work queue thread and starts it running. The function
|
||||||
* should not be re-invoked on a queue.
|
* 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.
|
* @param stack pointer to the work thread stack area.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue