diff options
| author | Meco Man <[email protected]> | 2022-01-16 16:00:55 -0500 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2022-01-20 20:58:46 +0800 |
| commit | 8bf5a285281d5699630fa1d2c9f12db1d0d2263c (patch) | |
| tree | a95b5b72a22228b0c1662598d977da1c7499c515 /components | |
| parent | 36cbc1fd2f811f00280fe32cec8ff228d6142788 (diff) | |
[workqueue] 增加rt_work_urgent
Diffstat (limited to 'components')
| -rw-r--r-- | components/drivers/include/ipc/workqueue.h | 1 | ||||
| -rw-r--r-- | components/drivers/src/workqueue.c | 17 |
2 files changed, 16 insertions, 2 deletions
diff --git a/components/drivers/include/ipc/workqueue.h b/components/drivers/include/ipc/workqueue.h index 4403969e67..b2224bdcf4 100644 --- a/components/drivers/include/ipc/workqueue.h +++ b/components/drivers/include/ipc/workqueue.h @@ -66,6 +66,7 @@ rt_err_t rt_workqueue_urgent_work(struct rt_workqueue *queue, struct rt_work *wo #ifdef RT_USING_SYSTEM_WORKQUEUE rt_err_t rt_work_submit(struct rt_work *work, rt_tick_t ticks); +rt_err_t rt_work_urgent(struct rt_work *work); rt_err_t rt_work_cancel(struct rt_work *work); #endif /* RT_USING_SYSTEM_WORKQUEUE */ diff --git a/components/drivers/src/workqueue.c b/components/drivers/src/workqueue.c index fe42ede0f6..58cb0ddf56 100644 --- a/components/drivers/src/workqueue.c +++ b/components/drivers/src/workqueue.c @@ -7,7 +7,8 @@ * Date Author Notes * 2017-02-27 Bernard fix the re-work issue. * 2021-08-01 Meco Man remove rt_delayed_work_init() - * 2021-08-14 Jackistang add comments for function interface. + * 2021-08-14 Jackistang add comments for function interface + * 2022-01-16 Meco Man add rt_work_urgent() */ #include <rthw.h> @@ -469,6 +470,18 @@ rt_err_t rt_work_submit(struct rt_work *work, rt_tick_t ticks) } /** + * @brief Submit a work item to the system work queue without delay. This work item will be executed after the current work item. + * + * @param work is a pointer to the work item object. + * + * @return RT_EOK Success. + */ +rt_err_t rt_work_urgent(struct rt_work *work) +{ + return rt_workqueue_urgent_work(sys_workq, work); +} + +/** * @brief Cancel a work item in the system work queue. * * @param work is a pointer to the work item object. @@ -486,7 +499,7 @@ static int rt_work_sys_workqueue_init(void) if (sys_workq != RT_NULL) return RT_EOK; - sys_workq = rt_workqueue_create("sys_work", RT_SYSTEM_WORKQUEUE_STACKSIZE, + sys_workq = rt_workqueue_create("sys workq", RT_SYSTEM_WORKQUEUE_STACKSIZE, RT_SYSTEM_WORKQUEUE_PRIORITY); RT_ASSERT(sys_workq != RT_NULL); |
