39 #ifndef OS_CONDITION_HPP 40 #define OS_CONDITION_HPP 43 #include "../rtt-config.h" 46 #ifdef ORO_OS_USE_BOOST_THREAD 48 #include <boost/thread/condition.hpp> 49 #include <boost/date_time/posix_time/posix_time_types.hpp> 62 #ifndef ORO_OS_USE_BOOST_THREAD 103 template<
class Predicate>
137 boost::condition_variable_any c;
175 template<
class Predicate>
176 bool wait (
Mutex& m, Predicate& p)
203 boost::posix_time::ptime p_time = boost::posix_time::from_time_t(0);
207 boost::posix_time::nanosec abs_p_time = boost::posix_time::nanoseconds(abs_time);
210 p_time = p_time + abs_p_time;
211 return c.timed_wait(m, p_time, &Condition::retfalse );
214 static bool retfalse() {
return false; }
int rtos_cond_destroy(rt_cond_t *cond)
int rtos_cond_timedwait(rt_cond_t *cond, rt_mutex_t *mutex, NANO_TIME abs_time)
An object oriented wrapper around a condition variable.
int rtos_cond_wait(rt_cond_t *cond, rt_mutex_t *mutex)
bool wait(Mutex &m, Predicate &p)
Wait forever until a condition occurs.
bool wait_until(Mutex &m, nsecs abs_time)
Wait for this condition, but don't wait longer for it than the specified absolute time...
Condition()
Initialize a Condition.
An object oriented wrapper around a non recursive mutex.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
~Condition()
Destroy a Condition.
long long nsecs
nanoseconds as a signed long long.
int rtos_cond_init(rt_cond_t *cond)
int rtos_cond_broadcast(rt_cond_t *cond)
void broadcast()
Wake all threads that are blocking in wait() or wait_until().
bool wait(Mutex &m)
Wait forever until a condition occurs.