incubator-nuttx/sched/wqueue
ligd bc17563a8f wqueue: fix race-condition on work_queue
CPU0                     CPU1

work_queue(a)            work_queue(a)
                         -> work_cancel(a)
-> work_cancel(a)
-> enter_critical()
-> sq_addlast(a)
-> leave_critical()
                         -> enter_critical()
                         -> sq_addlast(a) // double add, wrong
                         -> leave_critical()

Also, this happens in mulit-threads in one CPU.

Fix:

work_cancel() should in critical section.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-09 21:52:21 +02:00
..
Make.defs work_queue: schedule the work queue using the timer mechanism 2021-07-27 21:01:38 -07:00
kwork_cancel.c wqueue: change single queue to double queue to improve speed 2022-09-08 15:03:54 +02:00
kwork_inherit.c Don't include assert.h from public header file 2021-06-03 08:36:03 -07:00
kwork_notifier.c sched/wqueue: Change the return type of work_notifier_teardown to void 2022-05-14 00:35:29 +03:00
kwork_queue.c wqueue: fix race-condition on work_queue 2022-09-09 21:52:21 +02:00
kwork_thread.c wqueue: change single queue to double queue to improve speed 2022-09-08 15:03:54 +02:00
wqueue.h wqueue: change single queue to double queue to improve speed 2022-09-08 15:03:54 +02:00