@@ -76,12 +76,6 @@ Executor::Executor(const rclcpp::ExecutorOptions & options)
7676 " rclcpp" ,
7777 " failed to create wait set: %s" , rcl_get_error_string ().str );
7878 rcl_reset_error ();
79- if (rcl_guard_condition_fini (&interrupt_guard_condition_) != RCL_RET_OK) {
80- RCUTILS_LOG_ERROR_NAMED (
81- " rclcpp" ,
82- " failed to destroy guard condition: %s" , rcl_get_error_string ().str );
83- rcl_reset_error ();
84- }
8579 throw_from_rcl_error (ret, " Failed to create wait set in Executor constructor" );
8680 }
8781}
@@ -214,17 +208,14 @@ Executor::add_callback_group_to_map(
214208 // Also add to the map that contains all callback groups
215209 weak_groups_to_nodes_.insert (std::make_pair (weak_group_ptr, node_ptr));
216210 if (is_new_node) {
217- rclcpp::node_interfaces::NodeBaseInterface::WeakPtr node_weak_ptr ( node_ptr);
218- weak_nodes_to_guard_conditions_[node_weak_ptr ] = node_ptr-> get_notify_guard_condition () ;
211+ const auto & node_gc = node_ptr-> get_notify_rclcpp_guard_condition ( );
212+ weak_nodes_to_guard_conditions_[node_ptr ] = node_gc ;
219213 if (notify) {
220214 // Interrupt waiting to handle new node
221- rcl_ret_t ret = rcl_trigger_guard_condition (&interrupt_guard_condition_);
222- if (ret != RCL_RET_OK) {
223- throw_from_rcl_error (ret, " Failed to trigger guard condition on callback group add" );
224- }
215+ interrupt_guard_condition_.trigger ();
225216 }
226217 // Add the node's notify condition to the guard condition handles
227- memory_strategy_->add_guard_condition (node_ptr-> get_notify_guard_condition () );
218+ memory_strategy_->add_guard_condition (node_gc );
228219 }
229220}
230221
@@ -291,15 +282,11 @@ Executor::remove_callback_group_from_map(
291282 if (!has_node (node_ptr, weak_groups_to_nodes_associated_with_executor_) &&
292283 !has_node (node_ptr, weak_groups_associated_with_executor_to_nodes_))
293284 {
294- rclcpp::node_interfaces::NodeBaseInterface::WeakPtr node_weak_ptr (node_ptr);
295- weak_nodes_to_guard_conditions_.erase (node_weak_ptr);
285+ weak_nodes_to_guard_conditions_.erase (node_ptr);
296286 if (notify) {
297- rcl_ret_t ret = rcl_trigger_guard_condition (&interrupt_guard_condition_);
298- if (ret != RCL_RET_OK) {
299- throw_from_rcl_error (ret, " Failed to trigger guard condition on callback group remove" );
300- }
287+ interrupt_guard_condition_.trigger ();
301288 }
302- memory_strategy_->remove_guard_condition (node_ptr->get_notify_guard_condition ());
289+ memory_strategy_->remove_guard_condition (node_ptr->get_notify_rclcpp_guard_condition ());
303290 }
304291}
305292
@@ -470,10 +457,7 @@ void
470457Executor::cancel ()
471458{
472459 spinning.store (false );
473- rcl_ret_t ret = rcl_trigger_guard_condition (&interrupt_guard_condition_);
474- if (ret != RCL_RET_OK) {
475- throw_from_rcl_error (ret, " Failed to trigger guard condition in cancel" );
476- }
460+ interrupt_guard_condition_.trigger ();
477461}
478462
479463void
0 commit comments