mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 15:18:54 +08:00
px4_shutdown_request: make sure we release the lock in every case
board_shutdown should not return, but just in case
This commit is contained in:
@@ -94,6 +94,7 @@ int px4_unregister_shutdown_hook(shutdown_hook_t hook)
|
||||
|
||||
int px4_shutdown_request(bool reboot, bool to_bootloader)
|
||||
{
|
||||
int ret = 0;
|
||||
pthread_mutex_lock(&shutdown_mutex);
|
||||
|
||||
// FIXME: if shutdown_lock_counter > 0, we should wait, but unfortunately we don't have work queues
|
||||
@@ -101,12 +102,12 @@ int px4_shutdown_request(bool reboot, bool to_bootloader)
|
||||
px4_systemreset(to_bootloader);
|
||||
|
||||
} else {
|
||||
return board_shutdown();
|
||||
ret = board_shutdown();
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&shutdown_mutex);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user