mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-13 14:37:34 +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:
@@ -89,6 +89,14 @@ WorkItem::Deinit()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WorkItem::ScheduleClear()
|
||||
{
|
||||
if (_wq != nullptr) {
|
||||
_wq->Remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
WorkItem::elapsed_time() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user