add missing checks for rmw return codes
This commit is contained in:
parent
3bc43653d1
commit
d98e3fe427
3 changed files with 27 additions and 7 deletions
|
@ -52,8 +52,11 @@ public:
|
|||
virtual ~Executor()
|
||||
{
|
||||
if (interrupt_guard_condition_ != nullptr) {
|
||||
// TODO(wjwwood): Check ret code.
|
||||
rmw_destroy_guard_condition(interrupt_guard_condition_);
|
||||
rmw_ret_t status = rmw_destroy_guard_condition(interrupt_guard_condition_);
|
||||
if (status != RMW_RET_OK) {
|
||||
fprintf(stderr,
|
||||
"[rclcpp::error] failed to destroy guard condition: %s\n", rmw_get_error_string_safe());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,11 @@ public:
|
|||
if (!rclcpp::utilities::ok()) {
|
||||
return;
|
||||
}
|
||||
rmw_trigger_guard_condition(guard_condition_);
|
||||
rmw_ret_t status = rmw_trigger_guard_condition(guard_condition_);
|
||||
if (status != RMW_RET_OK) {
|
||||
fprintf(stderr,
|
||||
"[rclcpp::error] failed to trigger guard condition: %s\n", rmw_get_error_string_safe());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,11 @@ signal_handler(int signal_value)
|
|||
}
|
||||
#endif
|
||||
g_signal_status = signal_value;
|
||||
rmw_trigger_guard_condition(g_sigint_guard_cond_handle);
|
||||
rmw_ret_t status = rmw_trigger_guard_condition(g_sigint_guard_cond_handle);
|
||||
if (status != RMW_RET_OK) {
|
||||
fprintf(stderr,
|
||||
"[rclcpp::error] failed to trigger guard condition: %s\n", rmw_get_error_string_safe());
|
||||
}
|
||||
g_interrupt_condition_variable.notify_all();
|
||||
}
|
||||
} // namespace
|
||||
|
@ -97,8 +101,13 @@ init(int argc, char * argv[])
|
|||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
// TODO(wjwwood): Handle rmw_ret_t's value.
|
||||
rmw_init();
|
||||
rmw_ret_t status = rmw_init();
|
||||
if (status != RMW_RET_OK) {
|
||||
// *INDENT-OFF* (prevent uncrustify from making unecessary indents here)
|
||||
throw std::runtime_error(
|
||||
std::string("failed to initialize rmw implementation: ") + rmw_get_error_string_safe());
|
||||
// *INDENT-ON*
|
||||
}
|
||||
#ifdef HAS_SIGACTION
|
||||
struct sigaction action;
|
||||
memset(&action, 0, sizeof(action));
|
||||
|
@ -131,7 +140,11 @@ void
|
|||
shutdown()
|
||||
{
|
||||
g_signal_status = SIGINT;
|
||||
rmw_trigger_guard_condition(g_sigint_guard_cond_handle);
|
||||
rmw_ret_t status = rmw_trigger_guard_condition(g_sigint_guard_cond_handle);
|
||||
if (status != RMW_RET_OK) {
|
||||
fprintf(stderr,
|
||||
"[rclcpp::error] failed to trigger guard condition: %s\n", rmw_get_error_string_safe());
|
||||
}
|
||||
g_interrupt_condition_variable.notify_all();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue