提交 a96156fa 编写于 作者: 还_没_想_好's avatar 还_没_想_好

[workqueue] 提交正在执行的工作,返回 BUSY

上级 83dca09e
...@@ -90,6 +90,7 @@ static rt_err_t _workqueue_submit_work(struct rt_workqueue *queue, ...@@ -90,6 +90,7 @@ static rt_err_t _workqueue_submit_work(struct rt_workqueue *queue,
struct rt_work *work, rt_tick_t ticks) struct rt_work *work, rt_tick_t ticks)
{ {
rt_base_t level; rt_base_t level;
rt_err_t err;
level = rt_hw_interrupt_disable(); level = rt_hw_interrupt_disable();
/* remove list */ /* remove list */
...@@ -103,6 +104,11 @@ static rt_err_t _workqueue_submit_work(struct rt_workqueue *queue, ...@@ -103,6 +104,11 @@ static rt_err_t _workqueue_submit_work(struct rt_workqueue *queue,
rt_list_insert_after(queue->work_list.prev, &(work->list)); rt_list_insert_after(queue->work_list.prev, &(work->list));
work->flags |= RT_WORK_STATE_PENDING; work->flags |= RT_WORK_STATE_PENDING;
work->workqueue = queue; work->workqueue = queue;
err = RT_EOK;
}
else
{
err = -RT_EBUSY;
} }
/* whether the workqueue is doing work */ /* whether the workqueue is doing work */
...@@ -118,7 +124,7 @@ static rt_err_t _workqueue_submit_work(struct rt_workqueue *queue, ...@@ -118,7 +124,7 @@ static rt_err_t _workqueue_submit_work(struct rt_workqueue *queue,
{ {
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
} }
return RT_EOK; return err;
} }
else if (ticks < RT_TICK_MAX / 2) else if (ticks < RT_TICK_MAX / 2)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册