Same as to the ACE_Condition variable wrapper. More...
#include <Condition.h>
Public Types | |
typedef MUTEX | LOCK |
Useful typedef. | |
Public Member Functions | |
TAO_Condition (MUTEX &m) | |
Initialize the condition variable. | |
TAO_Condition (void) | |
~TAO_Condition (void) | |
Implicitly destroy the condition variable. | |
int | wait (const ACE_Time_Value *abstime) |
int | wait (void) |
Block on condition. | |
int | wait (MUTEX &mutex, const ACE_Time_Value *abstime=0) |
int | signal (void) |
Signal one waiting thread. | |
int | broadcast (void) |
Signal *all* waiting threads. | |
int | remove (void) |
Explicitly destroy the condition variable. | |
MUTEX * | mutex (void) |
Returns a reference to the underlying mutex_;. | |
Private Member Functions | |
void | operator= (const TAO_Condition< MUTEX > &) |
TAO_Condition (const TAO_Condition< MUTEX > &) | |
Private Attributes | |
MUTEX * | mutex_ |
Reference to mutex lock. | |
bool | delete_lock_ |
A flag to indicate whether the lock needs to be deleted. | |
TAO_SYNCH_CONDITION * | cond_ |
Condition variable. |
Same as to the ACE_Condition variable wrapper.
This class differs from ACE_Condition in that it uses a TAO_SYNCH_CONDITION instead of ACE_cond_t under the hood to provide blocking.
Definition at line 43 of file Condition.h.
typedef MUTEX TAO_Condition< MUTEX >::LOCK |
Useful typedef.
Definition at line 48 of file Condition.h.
TAO_Condition< MUTEX >::TAO_Condition | ( | MUTEX & | m | ) |
Initialize the condition variable.
Definition at line 16 of file Condition.cpp.
: mutex_ (&m), delete_lock_ (false), cond_ (0) { // @todo: Need to add the allocatore here.. ACE_NEW (this->cond_, TAO_SYNCH_CONDITION (*this->mutex_)); }
TAO_Condition< MUTEX >::TAO_Condition | ( | void | ) |
A default constructor. Since no lock is provided by the user, one will be created internally.
Definition at line 28 of file Condition.cpp.
: mutex_ (0), delete_lock_ (false), cond_ (0) { // @todo: Need to add the allocatore here.. ACE_NEW (this->mutex_, MUTEX); this->delete_lock_ = true; ACE_NEW (this->cond_, TAO_SYNCH_CONDITION (*this->mutex_)); }
TAO_Condition< MUTEX >::~TAO_Condition | ( | void | ) |
Implicitly destroy the condition variable.
Definition at line 47 of file Condition.cpp.
TAO_Condition< MUTEX >::TAO_Condition | ( | const TAO_Condition< MUTEX > & | ) | [private] |
int TAO_Condition< MUTEX >::broadcast | ( | void | ) |
Signal *all* waiting threads.
Definition at line 50 of file Condition.inl.
{ return this->cond_->broadcast (); }
MUTEX * TAO_Condition< MUTEX >::mutex | ( | void | ) |
Returns a reference to the underlying mutex_;.
Definition at line 38 of file Condition.inl.
{ return this->mutex_; }
void TAO_Condition< MUTEX >::operator= | ( | const TAO_Condition< MUTEX > & | ) | [private] |
int TAO_Condition< MUTEX >::remove | ( | void | ) |
Explicitly destroy the condition variable.
Definition at line 32 of file Condition.inl.
{ return this->cond_->remove (); }
int TAO_Condition< MUTEX >::signal | ( | void | ) |
Signal one waiting thread.
Definition at line 44 of file Condition.inl.
{ return this->cond_->signal (); }
int TAO_Condition< MUTEX >::wait | ( | void | ) |
int TAO_Condition< MUTEX >::wait | ( | MUTEX & | mutex, | |
const ACE_Time_Value * | abstime = 0 | |||
) |
Block on condition or until absolute time-of-day has passed. If abstime == 0 use "blocking" wait() semantics on the <mutex> passed as a parameter (this is useful if you need to store the <Condition> in shared memory). Else, if <abstime> != 0 and the call times out before the condition is signaled <wait> returns -1 and sets errno to ETIME.
Definition at line 14 of file Condition.inl.
int TAO_Condition< MUTEX >::wait | ( | const ACE_Time_Value * | abstime | ) |
Block on condition, or until absolute time-of-day has passed. If abstime == 0 use "blocking" <wait> semantics. Else, if <abstime> != 0 and the call times out before the condition is signaled <wait> returns -1 and sets errno to ETIME.
Definition at line 26 of file Condition.inl.
TAO_SYNCH_CONDITION* TAO_Condition< MUTEX >::cond_ [private] |
Condition variable.
Definition at line 105 of file Condition.h.
bool TAO_Condition< MUTEX >::delete_lock_ [private] |
A flag to indicate whether the lock needs to be deleted.
Definition at line 102 of file Condition.h.
MUTEX* TAO_Condition< MUTEX >::mutex_ [private] |
Reference to mutex lock.
Definition at line 99 of file Condition.h.