File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
doc/reference/kernel/threads Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -222,9 +222,11 @@ Defining and Controlling a Workqueue
222222====================================
223223
224224A workqueue is defined using a variable of type :c:struct: `k_work_q `.
225- The workqueue is initialized by defining the stack area used by its thread
226- and then calling :c:func: `k_work_queue_start `. The stack area must be defined
227- using :c:macro: `K_THREAD_STACK_DEFINE ` to ensure it is properly set up in
225+ The workqueue is initialized by defining the stack area used by its
226+ thread, initializing the :c:struct: `k_work_q `, either zeroing its
227+ memory or calling :c:func: `k_work_queue_init `, and then calling
228+ :c:func: `k_work_queue_start `. The stack area must be defined using
229+ :c:macro: `K_THREAD_STACK_DEFINE ` to ensure it is properly set up in
228230memory.
229231
230232The following code defines and initializes a workqueue:
@@ -238,6 +240,8 @@ The following code defines and initializes a workqueue:
238240
239241 struct k_work_q my_work_q;
240242
243+ k_work_queue_init(&my_work_q);
244+
241245 k_work_queue_start(&my_work_q, my_stack_area,
242246 K_THREAD_STACK_SIZEOF(my_stack_area), MY_PRIORITY,
243247 NULL);
Original file line number Diff line number Diff line change @@ -3061,7 +3061,9 @@ void k_work_queue_init(struct k_work_q *queue);
30613061 * This configures the work queue thread and starts it running. The function
30623062 * should not be re-invoked on a queue.
30633063 *
3064- * @param queue pointer to the queue structure.
3064+ * @param queue pointer to the queue structure. It must be initialized
3065+ * in zeroed/bss memory or with @ref k_work_queue_init before
3066+ * use.
30653067 *
30663068 * @param stack pointer to the work thread stack area.
30673069 *
You can’t perform that action at this time.
0 commit comments