mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 16:51:16 +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:
1 parent
977b80cee9
commit
18bc6cf872
4 files changed
+15
No files matched your search
@@ -66,7 +66,9 @@ ScheduledWorkItem::ScheduleOnInterval(uint32_t interval_us, uint32_t delay_us)
|
||||
void
|
||||
ScheduledWorkItem::ScheduleClear()
|
||||
{
|
||||
// first clear any scheduled hrt call, then remove the item from the runnable queue
|
||||
hrt_cancel(&_call);
|
||||
WorkItem::ScheduleClear();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in new issue
Block a user