mirror of
https://github.com/micro-ROS/micro-ROS-Agent.git
synced 2026-09-06 09:55:15 +02:00
Keep graph manager alive until destruction
This commit is contained in:
@@ -80,17 +80,15 @@ public:
|
||||
/**
|
||||
* @brief Default destructor.
|
||||
*/
|
||||
~GraphManager() = default;
|
||||
|
||||
void stop()
|
||||
{
|
||||
if (microros_graph_publisher_.joinable())
|
||||
{
|
||||
exit = true;
|
||||
cv_.notify_one();
|
||||
microros_graph_publisher_.join();
|
||||
}
|
||||
}
|
||||
~GraphManager()
|
||||
{
|
||||
if (microros_graph_publisher_.joinable())
|
||||
{
|
||||
exit = true;
|
||||
cv_.notify_one();
|
||||
microros_graph_publisher_.join();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implementation of the notification logic that updates the micro-ROS graph.
|
||||
|
||||
@@ -188,19 +188,11 @@ void Agent::run()
|
||||
void Agent::stop()
|
||||
{
|
||||
xrce_dds_agent_instance_.stop();
|
||||
|
||||
for (auto & element : graph_manager_map_)
|
||||
{
|
||||
element.second.stop();
|
||||
}
|
||||
|
||||
graph_manager_map_.clear();
|
||||
}
|
||||
|
||||
graph_manager::GraphManager* Agent::find_or_create_graph_manager(eprosima::fastdds::dds::DomainId_t domain_id)
|
||||
{
|
||||
|
||||
auto it = graph_manager_map_.find(domain_id);
|
||||
auto it = graph_manager_map_.find(domain_id);
|
||||
|
||||
if (it != graph_manager_map_.end()) {
|
||||
return &it->second;
|
||||
|
||||
Reference in New Issue
Block a user