mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
posix main wait_to_exit() fix and catch SIGTERM
- wait_to_exist() shouldn't depend on lockstep (px4_usleep)
This commit is contained in:
committed by
Lorenz Meier
parent
f7cf1ffc41
commit
9df06ffdea
@@ -425,7 +425,7 @@ void register_sig_handler()
|
||||
sigaction(SIGINT, &sig_int, nullptr);
|
||||
#endif
|
||||
|
||||
//sigaction(SIGTERM, &sig_int, nullptr);
|
||||
sigaction(SIGTERM, &sig_int, nullptr);
|
||||
sigaction(SIGFPE, &sig_fpe, nullptr);
|
||||
sigaction(SIGPIPE, &sig_pipe, nullptr);
|
||||
}
|
||||
@@ -433,7 +433,7 @@ void register_sig_handler()
|
||||
void sig_int_handler(int sig_num)
|
||||
{
|
||||
fflush(stdout);
|
||||
printf("\nExiting...\n");
|
||||
printf("\nPX4 Exiting...\n");
|
||||
fflush(stdout);
|
||||
px4_daemon::Pxh::stop();
|
||||
_exit_requested = true;
|
||||
@@ -552,7 +552,8 @@ int run_startup_script(const std::string &commands_file, const std::string &abso
|
||||
void wait_to_exit()
|
||||
{
|
||||
while (!_exit_requested) {
|
||||
px4_usleep(100000);
|
||||
// needs to be a regular sleep not dependant on lockstep (not px4_usleep)
|
||||
usleep(100000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user