* @brief This function will cancel all work items in work queue. * * @param queue is a pointer to the workqueue object. * * @return RT_EOK Success. */
| 384 | * @return RT_EOK Success. |
| 385 | */ |
| 386 | rt_err_t rt_workqueue_cancel_all_work(struct rt_workqueue *queue) |
| 387 | { |
| 388 | struct rt_work *work; |
| 389 | |
| 390 | RT_ASSERT(queue != RT_NULL); |
| 391 | |
| 392 | /* cancel work */ |
| 393 | rt_enter_critical(); |
| 394 | while (rt_list_isempty(&queue->work_list) == RT_FALSE) |
| 395 | { |
| 396 | work = rt_list_first_entry(&queue->work_list, struct rt_work, list); |
| 397 | _workqueue_cancel_work(queue, work); |
| 398 | } |
| 399 | /* cancel delay work */ |
| 400 | while (rt_list_isempty(&queue->delayed_list) == RT_FALSE) |
| 401 | { |
| 402 | work = rt_list_first_entry(&queue->delayed_list, struct rt_work, list); |
| 403 | _workqueue_cancel_work(queue, work); |
| 404 | } |
| 405 | rt_exit_critical(); |
| 406 | |
| 407 | return RT_EOK; |
| 408 | } |
| 409 | |
| 410 | #ifdef RT_USING_SYSTEM_WORKQUEUE |
| 411 |
no test coverage detected