修复同步取消锁中断等信号的问题

This commit is contained in:
tangyuxin 2021-02-01 14:31:45 +08:00
parent 5a16a2060e
commit 5b52e6c7e3

View File

@ -306,12 +306,9 @@ rt_err_t rt_workqueue_cancel_work(struct rt_workqueue *queue, struct rt_work *wo
rt_err_t rt_workqueue_cancel_work_sync(struct rt_workqueue *queue, struct rt_work *work) rt_err_t rt_workqueue_cancel_work_sync(struct rt_workqueue *queue, struct rt_work *work)
{ {
rt_base_t level;
RT_ASSERT(queue != RT_NULL); RT_ASSERT(queue != RT_NULL);
RT_ASSERT(work != RT_NULL); RT_ASSERT(work != RT_NULL);
level = rt_hw_interrupt_disable();
if (queue->work_current == work) /* it's current work in the queue */ if (queue->work_current == work) /* it's current work in the queue */
{ {
/* wait for work completion */ /* wait for work completion */
@ -319,10 +316,8 @@ rt_err_t rt_workqueue_cancel_work_sync(struct rt_workqueue *queue, struct rt_wor
} }
else else
{ {
rt_list_remove(&(work->list)); _workqueue_cancel_work(work);
} }
work->flags &= ~RT_WORK_STATE_PENDING;
rt_hw_interrupt_enable(level);
return RT_EOK; return RT_EOK;
} }