feat: Add ClockWaiter and ClockConditionalVariable
This replaces the Clock::cancel_sleep_or_wait with two new synchronization primitives, that can be instantiated separate from the Clock object.
The old API turned out the be a bad design, as one can not simply copy or create new clock objects.
If one copys a clock object, the same internal pimpl is copied, which is undesirable in combination with this API, as they then all share the same conditional. Therefore one can't do sleeps with multiple threads without waking up other threads.
If one tries to create a new clock, then there is no clockprovider registered to it. Leading to an unexpected behavior in simulation mode. We should perhaps add a BIG warning to the constructor to not do this.
This merge request is a first step in reworking the clock code, and I want to get some feedback on the API / class names, before refactoring further.
@arneboe Can you have a look the documentation and API ?
This pull request has been mentioned on ROS Discourse. There might be relevant details there:
https://discourse.ros.org/t/next-client-library-wg-meeting-friday-6th-december-2024-8am-pt/40954/2
Assigned @wjwwood, and recommend Client Library Working group review 🧇
This is the rolling version of general useful code used in 2674.
Ah, i missed that, sorry.
The changes look good. I think we should add unit-tests and then we are good to merge
I added tests, and fixed a bug that I found through this...
Pulls: ros2/rclcpp#2691 Gist: https://gist.githubusercontent.com/fujitatomoya/0d3dcb844cf0e7ec6ea465a2cfce1e9a/raw/66f4f58452aabc6993e98b6fe94f01ed818f73a0/ros2.repos BUILD args: --packages-above-and-dependencies rclcpp TEST args: --packages-above rclcpp ROS Distro: rolling Job: ci_launcher ci_launcher ran: https://ci.ros2.org/job/ci_launcher/15307
This PR now depends on https://github.com/ros2/rcpputils/pull/210
Pulls: ros2/rclcpp#2691 Gist: https://gist.githubusercontent.com/jmachowinski/9da107eefb9f3b72af8f2ef7876ff88b/raw/66f4f58452aabc6993e98b6fe94f01ed818f73a0/ros2.repos BUILD args: TEST args: ROS Distro: rolling Job: ci_launcher ci_launcher ran: https://ci.ros2.org/job/ci_launcher/15367
Pulls: ros2/rclcpp#2691 Gist: https://gist.githubusercontent.com/jmachowinski/a04d30035afad41146ae80dd67c1d8b9/raw/66f4f58452aabc6993e98b6fe94f01ed818f73a0/ros2.repos BUILD args: TEST args: ROS Distro: rolling Job: ci_launcher ci_launcher ran: https://ci.ros2.org/job/ci_launcher/15410
Pulls: ros2/rclcpp#2691 Gist: https://gist.githubusercontent.com/jmachowinski/02144ac023a0049d5d71095f052eb60d/raw/66f4f58452aabc6993e98b6fe94f01ed818f73a0/ros2.repos BUILD args: TEST args: ROS Distro: rolling Job: ci_launcher ci_launcher ran: https://ci.ros2.org/job/ci_launcher/15411
All failures in the CI are unrelated to this PR, I would say we are ready to merge.