mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-13 02:07:36 +08:00
ScheduledWorkItem::ScheduleClear: remove item from runnable queue
The existing behavior is unexpected: if the work item is already on the runnable queue, it will still be triggered after a call to ScheduleClear(). This can lead to race conditions.
This commit is contained in:
@@ -160,6 +160,7 @@ WorkQueue::Run()
|
||||
work_unlock(); // unlock work queue to run (item may requeue itself)
|
||||
work->RunPreamble();
|
||||
work->Run();
|
||||
// Note: after Run() we cannot access work anymore, as it might have been deleted
|
||||
work_lock(); // re-lock
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user