posix main wait_to_exit() fix and catch SIGTERM

- wait_to_exist() shouldn't depend on lockstep (px4_usleep)
This commit is contained in:
Daniel Agar
2020-01-01 15:28:13 -05:00
committed by Lorenz Meier
parent f7cf1ffc41
commit 9df06ffdea

View File

@@ -425,7 +425,7 @@ void register_sig_handler()
sigaction(SIGINT, &sig_int, nullptr); sigaction(SIGINT, &sig_int, nullptr);
#endif #endif
//sigaction(SIGTERM, &sig_int, nullptr); sigaction(SIGTERM, &sig_int, nullptr);
sigaction(SIGFPE, &sig_fpe, nullptr); sigaction(SIGFPE, &sig_fpe, nullptr);
sigaction(SIGPIPE, &sig_pipe, nullptr); sigaction(SIGPIPE, &sig_pipe, nullptr);
} }
@@ -433,7 +433,7 @@ void register_sig_handler()
void sig_int_handler(int sig_num) void sig_int_handler(int sig_num)
{ {
fflush(stdout); fflush(stdout);
printf("\nExiting...\n"); printf("\nPX4 Exiting...\n");
fflush(stdout); fflush(stdout);
px4_daemon::Pxh::stop(); px4_daemon::Pxh::stop();
_exit_requested = true; _exit_requested = true;
@@ -552,7 +552,8 @@ int run_startup_script(const std::string &commands_file, const std::string &abso
void wait_to_exit() void wait_to_exit()
{ {
while (!_exit_requested) { while (!_exit_requested) {
px4_usleep(100000); // needs to be a regular sleep not dependant on lockstep (not px4_usleep)
usleep(100000);
} }
} }