1 /*
2 * Copyright (c) 2016 Wind River Systems, Inc.
3 * Copyright (c) 2016 Intel Corporation
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8 /**
9 * @file
10 *
11 * System workqueue.
12 */
13
14 #include <zephyr/kernel.h>
15 #include <zephyr/init.h>
16
17 static K_KERNEL_STACK_DEFINE(sys_work_q_stack,
18 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE);
19
20 struct k_work_q k_sys_work_q;
21
k_sys_work_q_init(void)22 static int k_sys_work_q_init(void)
23 {
24 static const struct k_work_queue_config cfg = {
25 .name = "sysworkq",
26 .no_yield = IS_ENABLED(CONFIG_SYSTEM_WORKQUEUE_NO_YIELD),
27 .essential = true,
28 .work_timeout_ms = CONFIG_SYSTEM_WORKQUEUE_WORK_TIMEOUT_MS,
29 };
30
31 k_work_queue_start(&k_sys_work_q,
32 sys_work_q_stack,
33 K_KERNEL_STACK_SIZEOF(sys_work_q_stack),
34 CONFIG_SYSTEM_WORKQUEUE_PRIORITY, &cfg);
35 return 0;
36 }
37
38 SYS_INIT(k_sys_work_q_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
39