Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check return value of remaining rmw function calls #57

Merged
merged 1 commit into from
Jul 17, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions rclcpp/include/rclcpp/executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ class Executor
}
weak_nodes_.push_back(node_ptr);
// Interrupt waiting to handle new node
rmw_trigger_guard_condition(interrupt_guard_condition_);
rmw_ret_t status = rmw_trigger_guard_condition(interrupt_guard_condition_);
if (status != RMW_RET_OK) {
throw std::runtime_error(rmw_get_error_string_safe());
}
}

virtual void
Expand All @@ -90,7 +93,10 @@ class Executor
}));
// If the node was matched and removed, interrupt waiting
if (node_removed) {
rmw_trigger_guard_condition(interrupt_guard_condition_);
rmw_ret_t status = rmw_trigger_guard_condition(interrupt_guard_condition_);
if (status != RMW_RET_OK) {
throw std::runtime_error(rmw_get_error_string_safe());
}
}
}

Expand Down Expand Up @@ -148,7 +154,10 @@ class Executor
any_exec->callback_group->can_be_taken_from_.store(true);
// Wake the wait, because it may need to be recalculated or work that
// was previously blocked is now available.
rmw_trigger_guard_condition(interrupt_guard_condition_);
rmw_ret_t status = rmw_trigger_guard_condition(interrupt_guard_condition_);
if (status != RMW_RET_OK) {
throw std::runtime_error(rmw_get_error_string_safe());
}
}

static void
Expand Down Expand Up @@ -351,12 +360,15 @@ class Executor
}

// Now wait on the waitable subscriptions and timers
rmw_wait(
rmw_ret_t status = rmw_wait(
&subscriber_handles,
&guard_condition_handles,
&service_handles,
&client_handles,
nonblocking);
if (status != RMW_RET_OK) {
throw std::runtime_error(rmw_get_error_string_safe());
}
// If ctrl-c guard condition, return directly
if (guard_condition_handles.guard_conditions[0] != 0) {
// Make sure to free or clean memory
Expand Down