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 	struct k_work_queue_config cfg = {
25 		.name = "sysworkq",
26 		.no_yield = IS_ENABLED(CONFIG_SYSTEM_WORKQUEUE_NO_YIELD),
27 	};
28 
29 	k_work_queue_start(&k_sys_work_q,
30 			    sys_work_q_stack,
31 			    K_KERNEL_STACK_SIZEOF(sys_work_q_stack),
32 			    CONFIG_SYSTEM_WORKQUEUE_PRIORITY, &cfg);
33 	return 0;
34 }
35 
36 SYS_INIT(k_sys_work_q_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
37