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
kwork_cancel.c wqueue: change single queue to double queue to improve speed 2022-09-08 15:03:54 +02:00
kwork_inherit.c
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