nros C++ API
Lightweight ROS 2 client for embedded real-time systems (C++ headers)
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
nros::GuardCondition Class Reference

#include <guard_condition.hpp>

Public Member Functions

 GuardCondition ()
 
 GuardCondition (GuardCondition &&other)
 
bool is_valid () const
 Check if the guard condition is initialized and valid.
 
GuardConditionoperator= (GuardCondition &&other)
 
Result trigger ()
 
 ~GuardCondition ()
 Destructor — releases guard condition resources.
 

Friends

class Node
 

Detailed Description

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:

void on_signal(void* ctx) { /* handle event *&zwj;/ }
nros::GuardCondition guard;
NROS_TRY(node.create_guard_condition(guard, on_signal));
// From another thread:
guard.trigger();
// Callback fires on next spin_once()
Definition future.hpp:40

Constructor & Destructor Documentation

◆ ~GuardCondition()

nros::GuardCondition::~GuardCondition ( )
inline

Destructor — releases guard condition resources.

◆ GuardCondition() [1/2]

nros::GuardCondition::GuardCondition ( GuardCondition &&  other)
inline

◆ GuardCondition() [2/2]

nros::GuardCondition::GuardCondition ( )
inline

Default constructor — creates an uninitialized guard condition. Use Node::create_guard_condition() to initialize.

Member Function Documentation

◆ is_valid()

bool nros::GuardCondition::is_valid ( ) const
inline

Check if the guard condition is initialized and valid.

◆ operator=()

GuardCondition & nros::GuardCondition::operator= ( GuardCondition &&  other)
inline

◆ trigger()

Result nros::GuardCondition::trigger ( )
inline

Trigger the guard condition (thread-safe, lock-free).

The callback will be invoked on the next spin_once().

Friends And Related Symbol Documentation

◆ Node

friend class Node
friend

The documentation for this class was generated from the following file: