Public Member Functions | Protected Attributes | List of all members
RTT::os::Condition Class Reference

An object oriented wrapper around a condition variable. More...

#include <Condition.hpp>

Public Member Functions

void broadcast ()
 
 Condition ()
 
bool wait (Mutex &m)
 
template<class Predicate >
bool wait (Mutex &m, Predicate &p)
 
bool wait_until (Mutex &m, nsecs abs_time)
 
 ~Condition ()
 

Protected Attributes

rt_cond_t c
 

Detailed Description

An object oriented wrapper around a condition variable.

See also
Mutex, MutexRecursive

Definition at line 60 of file Condition.hpp.

Constructor & Destructor Documentation

RTT::os::Condition::Condition ( )
inline

Initialize a Condition.

Definition at line 69 of file Condition.hpp.

RTT::os::Condition::~Condition ( )
inline

Destroy a Condition. If the Condition is still locked, the RTOS will not be asked to clean up its resources.

Definition at line 79 of file Condition.hpp.

Member Function Documentation

void RTT::os::Condition::broadcast ( )
inline

Wake all threads that are blocking in wait() or wait_until().

Definition at line 113 of file Condition.hpp.

bool RTT::os::Condition::wait ( Mutex m)
inline

Wait forever until a condition occurs

Parameters
mThe mutex you hold locked when calling this function.
Returns
false if the waiting failed. This can only be caused by the OS aborting the waiting.

Definition at line 90 of file Condition.hpp.

template<class Predicate >
bool RTT::os::Condition::wait ( Mutex m,
Predicate &  p 
)
inline

Wait forever until a condition occurs

Parameters
mThe mutex you hold locked when calling this function.
pA function object returning a boolean
Returns
false if the waiting failed. This can only be caused by the OS aborting the waiting. Returns true when p() has been true.

Definition at line 104 of file Condition.hpp.

bool RTT::os::Condition::wait_until ( Mutex m,
nsecs  abs_time 
)
inline

Wait for this condition, but don't wait longer for it than the specified absolute time.

Parameters
mThe mutex you hold locked when calling this function.
abs_timeThe absolute time to wait until before the condition happens. Use rtos_get_time_ns() to get the current time and Seconds_to_nsecs to add a certain amount to the result.
Returns
true when the condition occured, false in case the timeout happened.

Definition at line 129 of file Condition.hpp.

Member Data Documentation

rt_cond_t RTT::os::Condition::c
protected

Definition at line 64 of file Condition.hpp.


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


rtt
Author(s): RTT Developers
autogenerated on Tue Jun 25 2019 19:33:46