Compare commits

..

1 Commits

Author SHA1 Message Date
Tomoya Fujita
0b04394806 keep the event alive throught the assertion, preveiting the race.
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
2026-03-17 16:58:39 +09:00
5 changed files with 7 additions and 32 deletions

View File

@@ -80,7 +80,7 @@ public:
node_base,
*rclcpp::get_message_typesupport_handle(topic_type, "rosidl_typesupport_cpp", *ts_lib),
topic_name,
force_cpu_buffer_backend_(options).to_rcl_subscription_options(qos),
options.to_rcl_subscription_options(qos),
options.event_callbacks,
options.use_default_callbacks,
DeliveredMessageKind::SERIALIZED_MESSAGE),
@@ -182,17 +182,6 @@ public:
private:
RCLCPP_DISABLE_COPY(GenericSubscription)
template<typename AllocatorT>
static rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>
force_cpu_buffer_backend_(
const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT> & options)
{
auto opts = options;
opts.acceptable_buffer_backends = "cpu";
return opts;
}
AnySubscriptionCallback<rclcpp::SerializedMessage, std::allocator<void>> any_callback_;
// The type support library should stay loaded, so it is stored in the GenericSubscription
std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;

View File

@@ -287,7 +287,6 @@ class Service
public std::enable_shared_from_this<Service<ServiceT>>
{
public:
using ServiceType = ServiceT;
using CallbackType = std::function<
void (
const std::shared_ptr<typename ServiceT::Request>,

View File

@@ -89,15 +89,6 @@ struct SubscriptionOptionsBase
QosOverridingOptions qos_overriding_options;
ContentFilterOptions content_filter_options;
/// Acceptable buffer backend names for this subscription.
/**
* Empty string or "cpu" means CPU-only (default for backward compatibility).
* "any" means all installed backends are acceptable.
* Comma-separated for specific backends, e.g. "cuda,demo".
* CPU is always implicitly acceptable regardless of this value.
*/
std::string acceptable_buffer_backends{"cpu"};
};
/// Structure containing optional configuration for Subscriptions.
@@ -154,11 +145,6 @@ struct SubscriptionOptionsWithAllocator : public SubscriptionOptionsBase
}
}
if (!acceptable_buffer_backends.empty()) {
result.rmw_subscription_options.acceptable_buffer_backends =
acceptable_buffer_backends.c_str();
}
return result;
}

View File

@@ -139,7 +139,8 @@ TEST_F(TestNodeGraph, construct_from_node)
EXPECT_NE(nullptr, node_graph()->get_graph_guard_condition());
// get_graph_event is non-const
EXPECT_NE(nullptr, node()->get_node_graph_interface()->get_graph_event());
auto event = node()->get_node_graph_interface()->get_graph_event();
EXPECT_NE(nullptr, event);
EXPECT_LE(1u, node_graph()->count_graph_users());
}

View File

@@ -24,16 +24,16 @@ int main(int argc, char * argv[])
/// Component container with a multi-threaded executor.
rclcpp::init(argc, argv);
rclcpp::executors::MultiThreadedExecutor::SharedPtr exec = nullptr;
const auto node = std::make_shared<rclcpp_components::ComponentManager>();
auto exec = std::make_shared<rclcpp::executors::MultiThreadedExecutor>();
auto node = std::make_shared<rclcpp_components::ComponentManager>();
if (node->has_parameter("thread_num")) {
const auto thread_num = node->get_parameter("thread_num").as_int();
exec = std::make_shared<rclcpp::executors::MultiThreadedExecutor>(
rclcpp::ExecutorOptions{}, thread_num);
node->set_executor(exec);
} else {
exec = std::make_shared<rclcpp::executors::MultiThreadedExecutor>();
node->set_executor(exec);
}
node->set_executor(exec);
exec->add_node(node);
exec->spin();