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

Avoid priority inversions in rclcpp #2078

Open
wants to merge 1 commit into
base: rolling
Choose a base branch
from

Conversation

WideAwakeTN
Copy link

@WideAwakeTN WideAwakeTN commented Jan 6, 2023

The content of this pull request ensures that threads in rclcpp will not experience priority inversions when using hard realtime scheduling, i.e. FIFO scheduling as defined in the POSIX standard. This is achieved by replacing std::mutex with rclcpp::PIMutex and std::recursive_mutex with rclcpp::RecursivePIMutex. To compile this pull request the following pull requests for rcutils and rcpputils are required:
ros2/rcpputils#174
ros2/rcutils#406

The code changes in this pull request should not effect the runtime behavior of existing ROS2 projects in a negative way. In case that a project uses ordinary fair/non-realtime thread scheduling it should behave as before.

In case this pull request gets accepted other ROS2 components can be made priority inversion safe in the manner which was demonstrated here. Refactoring all relevant ROS2 core components will make ROS2 more suitable for hard realtime scenarios.

Signed-off-by: Martin Mayer <[email protected]>
@ros-discourse
Copy link

This pull request has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/avoiding-priority-inversions-includes-draft-pull-requests/29219/1

@WideAwakeTN
Copy link
Author

A ROS Discourse article has been created for this pull request:
https://discourse.ros.org/t/avoiding-priority-inversions-includes-draft-pull-requests/29219

@WideAwakeTN WideAwakeTN marked this pull request as ready for review February 23, 2023 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants