You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Node has several functions for creating entities (subscription, publisher, service, client, timer) but not for removing them. This seems like an oversight. I think we should add remove functions, and entities should also remove themselves from Node in their destructor.
Reading more of the source (and remembering more) I think the idea is that there should not be remove or destroy functions, but I think we are missing some clean up which should happen in the destructors of these things, for example they might ought to wake up any blocking wait calls so the wait set can be remade without the recently destroyed objects. Like here:
Have the functions mentioned been removed? If not then I’d say the task in this issue is not done yet. I don’t think any more discussion needs to be done.
Activity
wjwwood commentedon Mar 13, 2016
The opposite of create is not remove... so at least I think the names of the functions should be destroy if you're going to have them.
Since they are scoped and the callback group objects which keep track of them store them as weak pointers:
https://github.com/ros2/rclcpp/blob/master/rclcpp/include/rclcpp/callback_group.hpp#L100
So when they are destroyed, they are effectively removed from any tracking.
wjwwood commentedon Mar 13, 2016
Reading more of the source (and remembering more) I think the idea is that there should not be remove or destroy functions, but I think we are missing some clean up which should happen in the destructors of these things, for example they might ought to wake up any blocking wait calls so the wait set can be remade without the recently destroyed objects. Like here:
https://github.com/ros2/rclcpp/blob/master/rclcpp/src/rclcpp/subscription.cpp#L41-L60
jackieokay commentedon Mar 13, 2016
Hmm, yeah, when I originally created this ticket I might have also been thinking of functions to remove a subscription/client/service from a node and manage the state in the node that tracks those entities (like this https://github.com/ros2/rclcpp/blob/master/rclcpp/include/rclcpp/node.hpp#L273-L276), without destroying the node itself.
wjwwood commentedon Mar 13, 2016
Searching, those might be dead code now:
It is declared, initialized, and incremented, but otherwise never referenced or decremented anywhere in
rclcpp.jackieokay commentedon Mar 13, 2016
oh, interesting. and they are private. We should definitely clean that up.
Karsten1987 commentedon Feb 26, 2018
@wjwwood is that still an ongoing discussion? It looks to me as if using shared_ptr/weak_ptr doesn't require any destroy functions.
wjwwood commentedon Feb 26, 2018
Have the functions mentioned been removed? If not then I’d say the task in this issue is not done yet. I don’t think any more discussion needs to be done.
Clarify that rcl_take_response() populates request_header (ros2#205)
writer interface (ros2#205)
clalancette commentedon Jan 19, 2024
It looks to me like everything has been done here (with destructors), and
number_of_subscriptionswas also removed. So closing this out.