#include <guard_condition.hpp>
Guard condition for cross-thread signaling.
Guard conditions allow any thread to wake the executor and optionally invoke a callback during spin_once(). The trigger() method is thread-safe and lock-free.
Usage:
Definition client.hpp:129
◆ ~GuardCondition()
| rclcpp::GuardCondition::~GuardCondition |
( |
| ) |
|
|
inline |
Destructor — releases the guard condition (issue 1667): its executor entry is freed, so spin_once stops polling it and the callback slot goes back to NROS_EXECUTOR_MAX_CBS. Sound because this object is non-copyable and the only holder of the trigger handle; trigger it from another thread only while it is alive.
◆ GuardCondition() [1/2]
◆ GuardCondition() [2/2]
| rclcpp::GuardCondition::GuardCondition |
( |
| ) |
|
|
inline |
◆ attach_closure_block()
| void rclcpp::GuardCondition::attach_closure_block |
( |
detail::HostedBlockBase * |
block | ) |
|
|
inline |
◆ clear()
| Result rclcpp::GuardCondition::clear |
( |
| ) |
|
|
inline |
Clear the flag without dispatching — the other half of is_triggered(), for a polling owner that has handled the event itself.
◆ is_triggered()
| bool rclcpp::GuardCondition::is_triggered |
( |
| ) |
const |
|
inline |
Is this guard condition triggered and not yet dispatched?
The RFC-0022 polling tier: a task that owns its own loop and never reaches spin_once still needs to see the flag another thread or an ISR set. rcl and rclcpp have no such reader — a wait set is the only way to observe an rclcpp guard condition — so this is ours, and phase-417 W4.e gave C++ and Rust the reader C already had.
The executor CONSUMES the flag when it dispatches, so this answers "set
and not yet dispatched": poll it or take the callback, not both.
◆ is_valid()
| bool rclcpp::GuardCondition::is_valid |
( |
| ) |
const |
|
inline |
Check if the guard condition is initialized and valid.
◆ operator=()
◆ trigger()
| Result rclcpp::GuardCondition::trigger |
( |
| ) |
|
|
inline |
Trigger the guard condition (thread-safe, lock-free).
The callback will be invoked on the next spin_once().
◆ ::rclcpp::Node
The documentation for this class was generated from the following file: