ROS 2 rclcpp + rcl - rolling
rolling-a919a6e5
ROS 2 C++ Client Library with ROS Client Library
|
#include <rclcpp/clock.hpp>
Classes | |
class | ClockWaiterImpl |
Public Member Functions | |
RCLCPP_PUBLIC | ClockWaiter (const rclcpp::Clock::SharedPtr &clock) |
RCLCPP_PUBLIC bool | wait_until (std::unique_lock< std::mutex > &lock, const rclcpp::Time &abs_time, const std::function< bool()> &pred) |
RCLCPP_PUBLIC void | notify_one () |
A synchronization primitive, equal to std::conditional_variable, that works with the rclcpp::Clock.
For more information on the API see https://en.cppreference.com/w/cpp/thread/condition_variable.
Note, this class does not handle shutdowns, if you want to haven them handles as well, use ClockConditionalVariable.
void rclcpp::ClockWaiter::notify_one | ( | ) |
bool rclcpp::ClockWaiter::wait_until | ( | std::unique_lock< std::mutex > & | lock, |
const rclcpp::Time & | abs_time, | ||
const std::function< bool()> & | pred | ||
) |
Calling this function will block the current thread, until abs_time is reached, or pred returns true.
lock | A locked lock. The lock must be locked at call time, or this method will throw. The lock will be atomically released and this thread will blocked. |
abs_time | The time until which this thread shall be blocked. |
pred | may be called in cased of spurious wakeups, but must be called every time notify_one() was called. During the call to pred, the given lock will be locked. This method will return, if pred returns true. |