forked from Archive/PX4-Autopilot
uorb callbacks: fix unregister ordering to avoid race conditions
The order should be: first unregister, then remove the item from the runnable queue.
This commit is contained in:
parent
18bc6cf872
commit
3fef401e81
|
@ -126,8 +126,8 @@ bool MixingOutput::updateSubscriptions(bool allow_wq_switch)
|
|||
|
||||
if (_scheduling_policy == SchedulingPolicy::Auto) {
|
||||
// first clear everything
|
||||
_interface.ScheduleClear();
|
||||
unregister();
|
||||
_interface.ScheduleClear();
|
||||
|
||||
// if subscribed to control group 0 or 1 then move to the rate_ctrl WQ
|
||||
const bool sub_group_0 = (_groups_required & (1 << 0));
|
||||
|
|
|
@ -71,14 +71,14 @@ bool VehicleAcceleration::Start()
|
|||
|
||||
void VehicleAcceleration::Stop()
|
||||
{
|
||||
Deinit();
|
||||
|
||||
// clear all registered callbacks
|
||||
for (auto &sub : _sensor_sub) {
|
||||
sub.unregisterCallback();
|
||||
}
|
||||
|
||||
_sensor_selection_sub.unregisterCallback();
|
||||
|
||||
Deinit();
|
||||
}
|
||||
|
||||
void VehicleAcceleration::CheckFilters()
|
||||
|
|
|
@ -74,14 +74,14 @@ bool VehicleAngularVelocity::Start()
|
|||
|
||||
void VehicleAngularVelocity::Stop()
|
||||
{
|
||||
Deinit();
|
||||
|
||||
// clear all registered callbacks
|
||||
for (auto &sub : _sensor_sub) {
|
||||
sub.unregisterCallback();
|
||||
}
|
||||
|
||||
_sensor_selection_sub.unregisterCallback();
|
||||
|
||||
Deinit();
|
||||
}
|
||||
|
||||
void VehicleAngularVelocity::CheckFilters()
|
||||
|
|
|
@ -66,11 +66,11 @@ bool VehicleIMU::Start()
|
|||
|
||||
void VehicleIMU::Stop()
|
||||
{
|
||||
Deinit();
|
||||
|
||||
// clear all registered callbacks
|
||||
_sensor_accel_integrated_sub.unregisterCallback();
|
||||
_sensor_gyro_integrated_sub.unregisterCallback();
|
||||
|
||||
Deinit();
|
||||
}
|
||||
|
||||
void VehicleIMU::ParametersUpdate(bool force)
|
||||
|
|
Loading…
Reference in New Issue