mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-01 18:24:06 +08:00
mavlink: prevent race if shut down immediately
If we do mavlink stop-all right after mavlink start, we do a perf_free before actually having stopped the threads accessing the perf counters.
This commit is contained in:
parent
0486d69240
commit
b0035e5704
@ -183,9 +183,6 @@ Mavlink::Mavlink() :
|
||||
|
||||
Mavlink::~Mavlink()
|
||||
{
|
||||
perf_free(_loop_perf);
|
||||
perf_free(_loop_interval_perf);
|
||||
|
||||
if (_task_running) {
|
||||
/* task wakes up every 10ms or so at the longest */
|
||||
_task_should_exit = true;
|
||||
@ -205,6 +202,9 @@ Mavlink::~Mavlink()
|
||||
}
|
||||
} while (_task_running);
|
||||
}
|
||||
|
||||
perf_free(_loop_perf);
|
||||
perf_free(_loop_interval_perf);
|
||||
}
|
||||
|
||||
void
|
||||
@ -2458,9 +2458,6 @@ Mavlink::task_main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
perf_end(_loop_perf);
|
||||
|
||||
/* confirm task running only once fully initialized */
|
||||
_task_running = true;
|
||||
}
|
||||
|
||||
/* first wait for threads to complete before tearing down anything */
|
||||
|
||||
@ -546,7 +546,7 @@ private:
|
||||
|
||||
uORB::PublicationQueued<telemetry_status_s> _telem_status_pub{ORB_ID(telemetry_status)};
|
||||
|
||||
bool _task_running{false};
|
||||
bool _task_running{true};
|
||||
static bool _boot_complete;
|
||||
static constexpr int MAVLINK_MAX_INSTANCES{4};
|
||||
static constexpr int MAVLINK_MIN_INTERVAL{1500};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user