diff --git a/components/drivers/include/ipc/workqueue.h b/components/drivers/include/ipc/workqueue.h index 4403969e67d05190d039aafd000f1f1c22c1e75c..b2224bdcf4fa404dc951f0ead21b0cc988eb4d93 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 fe42ede0f6aaddc1ae42b44ae7ef1985522b6d43..58cb0ddf5693a64d728cdebee3921a1fe674a478 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 @@ -468,6 +469,18 @@ rt_err_t rt_work_submit(struct rt_work *work, rt_tick_t ticks) return rt_workqueue_submit_work(sys_workq, work, 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. * @@ -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);