{"action":"created","comment":{"url":"https://api.github.com/repos/ros2/rclcpp/pulls/comments/90090593","pull_request_review_id":10615037,"id":90090593,"diff_hunk":"@@ -379,6 +379,11 @@ class Node : public std::enable_shared_from_this<Node>\n \n   std::atomic_bool has_executor;\n \n+  RCLCPP_PUBLIC\n+  void\n+  add_service(const rclcpp::service::ServiceBase::SharedPtr & service,","path":"rclcpp/include/rclcpp/node.hpp","position":null,"original_position":6,"commit_id":"a219761741997fb0e618fa4358ad9c9e5657ab50","original_commit_id":"c4b367e17900c9349e0728efed69a5e8df0e0e76","user":{"login":"wjwwood","id":100427,"avatar_url":"https://avatars.githubusercontent.com/u/100427?v=3","gravatar_id":"","url":"https://api.github.com/users/wjwwood","html_url":"https://github.com/wjwwood","followers_url":"https://api.github.com/users/wjwwood/followers","following_url":"https://api.github.com/users/wjwwood/following{/other_user}","gists_url":"https://api.github.com/users/wjwwood/gists{/gist_id}","starred_url":"https://api.github.com/users/wjwwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjwwood/subscriptions","organizations_url":"https://api.github.com/users/wjwwood/orgs","repos_url":"https://api.github.com/users/wjwwood/repos","events_url":"https://api.github.com/users/wjwwood/events{/privacy}","received_events_url":"https://api.github.com/users/wjwwood/received_events","type":"User","site_admin":false},"body":"If you actually read that post, it points out that copying shared pointers is more expensive compared to copying normal pointers or references, and that using a const reference only becomes a problem if you store the references in a vector or pass it to a function in another thread. Neither of which are happening here. I'd say that const reference is fine here, but you might still choose to not use const reference for other reasons (like the fact that it is a public interface which someone could misuse).\r\n\r\n> In controlled circumstances you can pass the shared pointer by constant reference. Be sure that nobody is concurrently deleting the object, though this shouldn't be too hard if you're careful about to whom you give references.\r\n\r\nI'd call this a controlled circumstance.\r\n\r\nIn this past we've solved issues before by removing the pass by reference of shared pointers, but in my opinion that's just using shared pointers to make the functions thread safe and generally doesn't have anything to do with shared pointers. We'd have the same problem if we were using raw pointers, i.e. someone calls this function in one thread and destroys the object (`Node`) in another thread. This is a general thread-safety issue, not a problem with how we're using shared pointers with const reference passing.","created_at":"2016-11-29T19:28:29Z","updated_at":"2016-11-29T19:28:29Z","html_url":"https://github.com/ros2/rclcpp/pull/279#discussion_r90090593","pull_request_url":"https://api.github.com/repos/ros2/rclcpp/pulls/279","_links":{"self":{"href":"https://api.github.com/repos/ros2/rclcpp/pulls/comments/90090593"},"html":{"href":"https://github.com/ros2/rclcpp/pull/279#discussion_r90090593"},"pull_request":{"href":"https://api.github.com/repos/ros2/rclcpp/pulls/279"}}},"pull_request":{"url":"https://api.github.com/repos/ros2/rclcpp/pulls/279","id":94457625,"html_url":"https://github.com/ros2/rclcpp/pull/279","diff_url":"https://github.com/ros2/rclcpp/pull/279.diff","patch_url":"https://github.com/ros2/rclcpp/pull/279.patch","issue_url":"https://api.github.com/repos/ros2/rclcpp/issues/279","number":279,"state":"open","locked":false,"title":"(dev) construct service from existing rcl_service_t","user":{"login":"Karsten1987","id":5419873,"avatar_url":"https://avatars.githubusercontent.com/u/5419873?v=3","gravatar_id":"","url":"https://api.github.com/users/Karsten1987","html_url":"https://github.com/Karsten1987","followers_url":"https://api.github.com/users/Karsten1987/followers","following_url":"https://api.github.com/users/Karsten1987/following{/other_user}","gists_url":"https://api.github.com/users/Karsten1987/gists{/gist_id}","starred_url":"https://api.github.com/users/Karsten1987/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Karsten1987/subscriptions","organizations_url":"https://api.github.com/users/Karsten1987/orgs","repos_url":"https://api.github.com/users/Karsten1987/repos","events_url":"https://api.github.com/users/Karsten1987/events{/privacy}","received_events_url":"https://api.github.com/users/Karsten1987/received_events","type":"User","site_admin":false},"body":"this PR enables a wrapping around a rcl_service_t which is externally initialized. The goal here is to instantiate a service on the rcl level and still be able to add it into a rclcpp executor. \r\n\r\nOn the flipside, I have to have a boolean flag stating whether we own ownership over this service or not. This becomes important when trying to destroy the service. ","created_at":"2016-11-18T23:53:03Z","updated_at":"2016-11-29T19:28:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b3b47bab4adbc17703e8339b2beb27894907d670","assignee":{"login":"Karsten1987","id":5419873,"avatar_url":"https://avatars.githubusercontent.com/u/5419873?v=3","gravatar_id":"","url":"https://api.github.com/users/Karsten1987","html_url":"https://github.com/Karsten1987","followers_url":"https://api.github.com/users/Karsten1987/followers","following_url":"https://api.github.com/users/Karsten1987/following{/other_user}","gists_url":"https://api.github.com/users/Karsten1987/gists{/gist_id}","starred_url":"https://api.github.com/users/Karsten1987/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Karsten1987/subscriptions","organizations_url":"https://api.github.com/users/Karsten1987/orgs","repos_url":"https://api.github.com/users/Karsten1987/repos","events_url":"https://api.github.com/users/Karsten1987/events{/privacy}","received_events_url":"https://api.github.com/users/Karsten1987/received_events","type":"User","site_admin":false},"assignees":[{"login":"Karsten1987","id":5419873,"avatar_url":"https://avatars.githubusercontent.com/u/5419873?v=3","gravatar_id":"","url":"https://api.github.com/users/Karsten1987","html_url":"https://github.com/Karsten1987","followers_url":"https://api.github.com/users/Karsten1987/followers","following_url":"https://api.github.com/users/Karsten1987/following{/other_user}","gists_url":"https://api.github.com/users/Karsten1987/gists{/gist_id}","starred_url":"https://api.github.com/users/Karsten1987/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Karsten1987/subscriptions","organizations_url":"https://api.github.com/users/Karsten1987/orgs","repos_url":"https://api.github.com/users/Karsten1987/repos","events_url":"https://api.github.com/users/Karsten1987/events{/privacy}","received_events_url":"https://api.github.com/users/Karsten1987/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ros2/rclcpp/pulls/279/commits","review_comments_url":"https://api.github.com/repos/ros2/rclcpp/pulls/279/comments","review_comment_url":"https://api.github.com/repos/ros2/rclcpp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ros2/rclcpp/issues/279/comments","statuses_url":"https://api.github.com/repos/ros2/rclcpp/statuses/a219761741997fb0e618fa4358ad9c9e5657ab50","head":{"label":"ros2:service_refactor","ref":"service_refactor","sha":"a219761741997fb0e618fa4358ad9c9e5657ab50","user":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"repo":{"id":22737333,"name":"rclcpp","full_name":"ros2/rclcpp","owner":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros2/rclcpp","description":"rclcpp (ROS Client Library for C++)","fork":false,"url":"https://api.github.com/repos/ros2/rclcpp","forks_url":"https://api.github.com/repos/ros2/rclcpp/forks","keys_url":"https://api.github.com/repos/ros2/rclcpp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/rclcpp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/rclcpp/teams","hooks_url":"https://api.github.com/repos/ros2/rclcpp/hooks","issue_events_url":"https://api.github.com/repos/ros2/rclcpp/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/rclcpp/events","assignees_url":"https://api.github.com/repos/ros2/rclcpp/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/rclcpp/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/rclcpp/tags","blobs_url":"https://api.github.com/repos/ros2/rclcpp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/rclcpp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/rclcpp/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/rclcpp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/rclcpp/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/rclcpp/languages","stargazers_url":"https://api.github.com/repos/ros2/rclcpp/stargazers","contributors_url":"https://api.github.com/repos/ros2/rclcpp/contributors","subscribers_url":"https://api.github.com/repos/ros2/rclcpp/subscribers","subscription_url":"https://api.github.com/repos/ros2/rclcpp/subscription","commits_url":"https://api.github.com/repos/ros2/rclcpp/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/rclcpp/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/rclcpp/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/rclcpp/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/rclcpp/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/rclcpp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/rclcpp/merges","archive_url":"https://api.github.com/repos/ros2/rclcpp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/rclcpp/downloads","issues_url":"https://api.github.com/repos/ros2/rclcpp/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/rclcpp/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/rclcpp/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/rclcpp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/rclcpp/labels{/name}","releases_url":"https://api.github.com/repos/ros2/rclcpp/releases{/id}","deployments_url":"https://api.github.com/repos/ros2/rclcpp/deployments","created_at":"2014-08-07T21:36:38Z","updated_at":"2016-11-28T21:08:13Z","pushed_at":"2016-11-29T16:00:39Z","git_url":"git://github.com/ros2/rclcpp.git","ssh_url":"git@github.com:ros2/rclcpp.git","clone_url":"https://github.com/ros2/rclcpp.git","svn_url":"https://github.com/ros2/rclcpp","homepage":"","size":1149,"stargazers_count":15,"watchers_count":15,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":44,"forks":14,"open_issues":44,"watchers":15,"default_branch":"master"}},"base":{"label":"ros2:master","ref":"master","sha":"a987f8d01515562f5727158eb25a957150db4e45","user":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"repo":{"id":22737333,"name":"rclcpp","full_name":"ros2/rclcpp","owner":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros2/rclcpp","description":"rclcpp (ROS Client Library for C++)","fork":false,"url":"https://api.github.com/repos/ros2/rclcpp","forks_url":"https://api.github.com/repos/ros2/rclcpp/forks","keys_url":"https://api.github.com/repos/ros2/rclcpp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/rclcpp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/rclcpp/teams","hooks_url":"https://api.github.com/repos/ros2/rclcpp/hooks","issue_events_url":"https://api.github.com/repos/ros2/rclcpp/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/rclcpp/events","assignees_url":"https://api.github.com/repos/ros2/rclcpp/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/rclcpp/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/rclcpp/tags","blobs_url":"https://api.github.com/repos/ros2/rclcpp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/rclcpp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/rclcpp/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/rclcpp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/rclcpp/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/rclcpp/languages","stargazers_url":"https://api.github.com/repos/ros2/rclcpp/stargazers","contributors_url":"https://api.github.com/repos/ros2/rclcpp/contributors","subscribers_url":"https://api.github.com/repos/ros2/rclcpp/subscribers","subscription_url":"https://api.github.com/repos/ros2/rclcpp/subscription","commits_url":"https://api.github.com/repos/ros2/rclcpp/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/rclcpp/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/rclcpp/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/rclcpp/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/rclcpp/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/rclcpp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/rclcpp/merges","archive_url":"https://api.github.com/repos/ros2/rclcpp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/rclcpp/downloads","issues_url":"https://api.github.com/repos/ros2/rclcpp/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/rclcpp/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/rclcpp/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/rclcpp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/rclcpp/labels{/name}","releases_url":"https://api.github.com/repos/ros2/rclcpp/releases{/id}","deployments_url":"https://api.github.com/repos/ros2/rclcpp/deployments","created_at":"2014-08-07T21:36:38Z","updated_at":"2016-11-28T21:08:13Z","pushed_at":"2016-11-29T16:00:39Z","git_url":"git://github.com/ros2/rclcpp.git","ssh_url":"git@github.com:ros2/rclcpp.git","clone_url":"https://github.com/ros2/rclcpp.git","svn_url":"https://github.com/ros2/rclcpp","homepage":"","size":1149,"stargazers_count":15,"watchers_count":15,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":44,"forks":14,"open_issues":44,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ros2/rclcpp/pulls/279"},"html":{"href":"https://github.com/ros2/rclcpp/pull/279"},"issue":{"href":"https://api.github.com/repos/ros2/rclcpp/issues/279"},"comments":{"href":"https://api.github.com/repos/ros2/rclcpp/issues/279/comments"},"review_comments":{"href":"https://api.github.com/repos/ros2/rclcpp/pulls/279/comments"},"review_comment":{"href":"https://api.github.com/repos/ros2/rclcpp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ros2/rclcpp/pulls/279/commits"},"statuses":{"href":"https://api.github.com/repos/ros2/rclcpp/statuses/a219761741997fb0e618fa4358ad9c9e5657ab50"}}}}
{"actor":{"display_login":"wjwwood"}}