#include <Condition_T.h>
Inheritance diagram for ACE_Condition< MUTEX >:
Public Member Functions | |
ACE_Condition (MUTEX &m, int type=USYNC_THREAD, const ACE_TCHAR *name=0, void *arg=0) | |
Initialize the condition variable. | |
~ACE_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_;. | |
void | dump (void) const |
Dump the state of an object. | |
Protected Attributes | |
ACE_cond_t | cond_ |
Condition variable. | |
MUTEX & | mutex_ |
Reference to mutex lock. | |
Private Member Functions | |
void | operator= (const ACE_Condition< MUTEX > &) |
ACE_Condition (const ACE_Condition< MUTEX > &) |
A condition variable enables threads to atomically block and test the condition under the protection of a mutual exclu- sion lock (mutex) until the condition is satisfied. That is, the mutex must have been held by the thread before calling wait or signal on the condition. If the condition is false, a thread blocks on a condition variable and atomically releases the mutex that is waiting for the condition to change. If another thread changes the condition, it may wake up waiting threads by signaling the associated condition variable. The waiting threads, upon awakening, reacquire the mutex and re-evaluate the condition. Note, you can only parameterize with ACE_Thread_Mutex, ACE_Recursive_Thread_Mutex, or ACE_Null_Mutex.
Definition at line 54 of file Condition_T.h.
|
Initialize the condition variable.
Definition at line 56 of file Condition_T.cpp. References ACE_ERROR, ACE_TCHAR, ACE_TEXT, ACE_OS::cond_init(), and LM_ERROR.
00060 : 00061 mutex_ (m) 00062 { 00063 // ACE_TRACE ("ACE_Condition<MUTEX>::ACE_Condition"); 00064 00065 if (ACE_OS::cond_init (&this->cond_, 00066 (short) type, 00067 name, 00068 arg) != 0) 00069 ACE_ERROR ((LM_ERROR, 00070 ACE_TEXT ("%p\n"), 00071 ACE_TEXT ("ACE_Condition::ACE_Condition"))); 00072 } |
|
Implicitly destroy the condition variable.
Definition at line 44 of file Condition_Recursive_Thread_Mutex.cpp. References ACE_Condition< MUTEX >::remove().
00045 { 00046 this->remove (); 00047 } |
|
|
|
Signal *all* waiting threads.
Definition at line 110 of file Condition_Recursive_Thread_Mutex.cpp. References ACE_OS::cond_broadcast().
00111 { 00112 return ACE_OS::cond_broadcast (&this->cond_); 00113 } |
|
Dump the state of an object.
Reimplemented in ACE_Thread_Condition< MUTEX >, and ACE_Thread_Condition< ACE_Thread_Mutex >. Definition at line 30 of file Condition_Recursive_Thread_Mutex.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TEXT, and LM_DEBUG. Referenced by ACE_Thread_Condition< MUTEX >::dump().
00031 { 00032 #if defined (ACE_HAS_DUMP) 00033 // ACE_TRACE ("ACE_Condition<MUTEX>::dump"); 00034 00035 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); 00036 // No dump method for ACE_cond_t even in emulated mode. 00037 // cond_.dump (); 00038 this->mutex_.dump (); 00039 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); 00040 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); 00041 #endif /* ACE_HAS_DUMP */ 00042 } |
|
Returns a reference to the underlying mutex_;.
Definition at line 116 of file Condition_Recursive_Thread_Mutex.cpp.
00117 { 00118 return this->mutex_; 00119 } |
|
|
|
Explicitly destroy the condition variable.
Definition at line 24 of file Condition_Recursive_Thread_Mutex.cpp. References ACE_OS::cond_destroy(). Referenced by ACE_Condition< MUTEX >::~ACE_Condition().
00025 { 00026 return ACE_OS::cond_destroy (&this->cond_); 00027 } |
|
Signal one waiting thread.
Definition at line 104 of file Condition_Recursive_Thread_Mutex.cpp. References ACE_OS::cond_signal().
00105 { 00106 return ACE_OS::cond_signal (&this->cond_); 00107 } |
|
Block on condition or until absolute time-of-day has passed. If abstime == 0 use "blocking" wait() semantics on the passed as a parameter (this is useful if you need to store the in shared memory). Else, if != 0 and the call times out before the condition is signaled returns -1 and sets errno to ETIME. Definition at line 94 of file Condition_T.cpp. References ACE_OS::cond_timedwait(), and ACE_Condition< MUTEX >::wait().
00096 { 00097 // ACE_TRACE ("ACE_Condition<MUTEX>::wait"); 00098 if (abstime == 0) 00099 return this->wait (); 00100 else 00101 { 00102 return ACE_OS::cond_timedwait (&this->cond_, 00103 &mutex.lock_, 00104 (ACE_Time_Value *) abstime); 00105 } 00106 } |
|
Block on condition.
Definition at line 86 of file Condition_T.cpp. References ACE_OS::cond_wait(). Referenced by ACE_Condition< MUTEX >::wait().
00087 { 00088 // ACE_TRACE ("ACE_Condition<MUTEX>::wait"); 00089 return ACE_OS::cond_wait (&this->cond_, 00090 &this->mutex_.lock_); 00091 } |
|
Block on condition, or until absolute time-of-day has passed. If abstime == 0 use "blocking" semantics. Else, if != 0 and the call times out before the condition is signaled returns -1 and sets errno to ETIME. Definition at line 56 of file Condition_Recursive_Thread_Mutex.cpp. References ACE_Condition< MUTEX >::wait().
00057 { 00058 return this->wait (this->mutex_, abstime); 00059 } |
|
Condition variable.
Definition at line 108 of file Condition_T.h. |
|
Reference to mutex lock.
Definition at line 111 of file Condition_T.h. |