ROS 2 rclcpp + rcl - kilted
kilted
ROS 2 C++ Client Library with ROS Client Library
|
#include <rclcpp/clock.hpp>
Classes | |
class | Impl |
Public Member Functions | |
RCLCPP_PUBLIC | ClockConditionalVariable (const rclcpp::Clock::SharedPtr &clock, rclcpp::Context::SharedPtr context=rclcpp::contexts::get_global_default_context()) |
RCLCPP_PUBLIC bool | wait_until (std::unique_lock< std::mutex > &lock, rclcpp::Time until, const std::function< bool()> &pred) |
RCLCPP_PUBLIC void | notify_one () |
RCLCPP_PUBLIC std::mutex & | mutex () |
A synchronization primitive, similar 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.
This primitive will wake up if the context was shut down.
std::mutex & rclcpp::ClockConditionalVariable::mutex | ( | ) |
void rclcpp::ClockConditionalVariable::notify_one | ( | ) |
bool rclcpp::ClockConditionalVariable::wait_until | ( | std::unique_lock< std::mutex > & | lock, |
rclcpp::Time | until, | ||
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. The given lock must be created using the mutex returned my mutex(). |
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. |