Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add max_duration to spin_some() #558

Merged
merged 1 commit into from
Sep 17, 2018
Merged

Add max_duration to spin_some() #558

merged 1 commit into from
Sep 17, 2018

Conversation

sloretz
Copy link
Contributor

@sloretz sloretz commented Sep 15, 2018

This adds a parameter to spin_some() for the maximum duration to spend executing work. It prevents spin_some() from blocking forever if there are always callbacks ready. The reason for adding it is to allow rviz to execute all callbacks without being limited by the gui or blocking it.

connects to ros2/ros1_bridge#133
Blocks ros2/rviz#354

CI ros2/rviz#354 (comment)

With max_duration spin_some will execute work until it has spent more
time than the elapsed duration.
@sloretz sloretz added enhancement New feature or request in review Waiting for review (Kanban column) labels Sep 15, 2018
@sloretz sloretz self-assigned this Sep 15, 2018
@sloretz sloretz merged commit b860b89 into master Sep 17, 2018
@sloretz sloretz deleted the rviz2_tf_lag branch September 17, 2018 22:51
@sloretz sloretz removed the in review Waiting for review (Kanban column) label Sep 17, 2018
*/
RCLCPP_PUBLIC
virtual void
spin_some();
spin_some(std::chrono::nanoseconds max_duration = std::chrono::nanoseconds(0));
Copy link
Member

@dirk-thomas dirk-thomas Sep 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would timeout match existing naming better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the behavior is different. I would expect timeout to mean the function blocks until that amount of time elapses, but this function will return immediately when no work is available regardless of max_duration.

nnmm pushed a commit to ApexAI/rclcpp that referenced this pull request Jul 9, 2022
Signed-off-by: Miaofei <miaofei@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants