forked from Archive/PX4-Autopilot
mavlink: shell expand locking (#19308)
- on some H7 boards (cuav x7pro tested) there's an occasional hard fault when starting the mavlink shell that is no longer reproducible with the slightly expanded locking - this is likely just changing the timing (holding the sched lock for longer), but this should be harmless for now until we can identify the root cause
This commit is contained in:
parent
af839c828d
commit
6359c8c008
|
@ -1334,18 +1334,20 @@ MavlinkShell *
|
|||
Mavlink::get_shell()
|
||||
{
|
||||
if (!_mavlink_shell) {
|
||||
_mavlink_shell = new MavlinkShell();
|
||||
MavlinkShell *shell = new MavlinkShell();
|
||||
|
||||
if (!_mavlink_shell) {
|
||||
if (!shell) {
|
||||
PX4_ERR("Failed to allocate a shell");
|
||||
|
||||
} else {
|
||||
int ret = _mavlink_shell->start();
|
||||
int ret = shell->start();
|
||||
|
||||
if (ret != 0) {
|
||||
if (ret == 0) {
|
||||
_mavlink_shell = shell;
|
||||
|
||||
} else {
|
||||
PX4_ERR("Failed to start shell (%i)", ret);
|
||||
delete _mavlink_shell;
|
||||
_mavlink_shell = nullptr;
|
||||
delete shell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,14 +148,14 @@ int MavlinkShell::start()
|
|||
close(fd_backups[i]);
|
||||
}
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
sched_unlock();
|
||||
#endif /* __PX4_NUTTX */
|
||||
|
||||
//close unused pipe fd's
|
||||
close(_shell_fds[0]);
|
||||
close(_shell_fds[1]);
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
sched_unlock();
|
||||
#endif /* __PX4_NUTTX */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue