work_q: Make k_delayed_work_cancel cancel work already pending

This has been a limitation caused by k_fifo which could only remove
items from the beggining, but with the change to use k_queue in
k_work_q it is now possible to remove items from any position with
use of k_queue_remove.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2017-07-03 19:24:10 +03:00 committed by Anas Nashif
commit c1fa82b3c6
3 changed files with 18 additions and 14 deletions

View file

@ -2049,7 +2049,7 @@ static inline void k_work_submit_to_queue(struct k_work_q *work_q,
struct k_work *work)
{
if (!atomic_test_and_set_bit(work->flags, K_WORK_STATE_PENDING)) {
k_fifo_put(&work_q->queue, work);
k_queue_append(&work_q->queue, work);
}
}