Make lifecycle demo automatically exit when done#558
Merged
Conversation
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Contributor
Author
mjcarroll
approved these changes
Apr 8, 2022
wjwwood
reviewed
May 13, 2022
| std::bind(callee_script, lc_client)); | ||
| auto wake_exec = std::async( | ||
| std::launch::async, | ||
| std::bind(wake_executor, script, std::ref(exe))); |
Member
There was a problem hiding this comment.
I would say this is unnecessarily complicated. I would instead move the callee_script into a one-off timer with zero duration.
Or better yet, run the executor's spin in a separate thread (use std::async if you like) and do the callee_script here in the main thread, then when that function is done cancel the executor and "join" the thread it was using to spin in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #504
This makes the lifecyle demo automatically exit when it's completed. First this PR fixes a bug in
lifecycle_service_clientwhere it's stuck waiting for the future to complete forever because of ros2/rclcpp#1916. Next this PR adds aShutdownaction to theon_exitargument of thelifecycle_service_clientNodeso that when it shuts down the other nodes are killed too.