#include <Synch.h>
Inheritance diagram for ACE_Condition< ACE_Recursive_Thread_Mutex >:


Public Methods | |
| ACE_Condition (ACE_Recursive_Thread_Mutex &m) | |
| Initialize the condition variable with a recursive mutex. More... | |
| ~ACE_Condition (void) | |
| Implicitly destroy the condition variable. More... | |
| int | remove (void) |
| int | wait (const ACE_Time_Value *abstime=0) |
| int | wait (ACE_Recursive_Thread_Mutex &mutex, const ACE_Time_Value *abstime=0) |
| int | signal (void) |
| Signal one waiting thread. More... | |
| int | broadcast (void) |
| Signal *all* waiting threads. More... | |
| ACE_Recursive_Thread_Mutex & | mutex (void) |
| Returns a reference to the underlying mutex;. More... | |
| void | dump (void) const |
| Dump the state of an object. More... | |
Private Methods | |
| void | operator= (const ACE_Condition< ACE_Recursive_Thread_Mutex > &) |
| ACE_Condition (const ACE_Condition< ACE_Recursive_Thread_Mutex > &) | |
Private Attributes | |
| ACE_cond_t | cond_ |
| A normal (i.e., non-recursive) condition variable. More... | |
| ACE_Recursive_Thread_Mutex & | mutex_ |
| Reference to the recursive mutex. More... | |
Definition at line 1780 of file Synch.h.
|
|
Implicitly destroy the condition variable.
Definition at line 914 of file Synch.cpp. References ACE_Condition::remove.
00915 {
00916 this->remove ();
00917 }
|
|
|
|
|
|
Initialize the condition variable with a recursive mutex.
Definition at line 920 of file Synch.cpp. References ACE_OS::cond_init.
00921 : mutex_ (m) 00922 { 00923 ACE_OS::cond_init (&this->cond_); 00924 } |
|
|
Signal *all* waiting threads.
Definition at line 985 of file Synch.cpp. References ACE_OS::cond_broadcast.
00986 {
00987 return ACE_OS::cond_broadcast (&this->cond_);
00988 }
|
|
|
Dump the state of an object.
Definition at line 901 of file Synch.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, LM_DEBUG, and ACE_Condition::mutex_.
00902 {
00903 // ACE_TRACE ("ACE_Condition<MUTEX>::dump");
00904
00905 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00906 // No dump method for ACE_cond_t even in emulated mode.
00907 // cond_.dump ();
00908 this->mutex_.dump ();
00909 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n")));
00910 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00911 }
|
|
|
Returns a reference to the underlying mutex;.
Definition at line 992 of file Synch.cpp. References ACE_Condition::mutex_.
00993 {
00994 return this->mutex_;
00995 }
|
|
|
|
|
|
Explicitly destroy the condition variable. Note that only one thread should call this method since it doesn't protect against race conditions. Definition at line 895 of file Synch.cpp. References ACE_OS::cond_destroy.
00896 {
00897 return ACE_OS::cond_destroy (&this->cond_);
00898 }
|
|
|
Signal one waiting thread.
Definition at line 978 of file Synch.cpp. References ACE_OS::cond_signal.
00979 {
00980 return ACE_OS::cond_signal (&this->cond_);
00981 }
|
|
||||||||||||
|
Block on condition or until absolute time-of-day has passed. If abstime == 0 use "blocking" wait() semantics on the recursive 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 935 of file Synch.cpp. References ACE_OS::cond_timedwait, ACE_OS::cond_wait, ACE_Recursive_Thread_Mutex::get_nesting_mutex, ACE_Recursive_Thread_Mutex::mutex, ACE_OS::recursive_mutex_cond_relock, and ACE_OS::recursive_mutex_cond_unlock.
00937 {
00938 ACE_recursive_mutex_state mutex_state_holder;
00939 ACE_recursive_thread_mutex_t &recursive_mutex = mutex.mutex ();
00940
00941 if (ACE_OS::recursive_mutex_cond_unlock (&recursive_mutex,
00942 mutex_state_holder) == -1)
00943 return -1;
00944
00945 // We wait on the condition, specifying the nesting mutex. For platforms
00946 // with ACE_HAS_RECURSIVE_MUTEXES, this is the recursive mutex itself,
00947 // and is the same as recursive_mutex, above. The caller should have been
00948 // holding the lock on entry to this method, and it is still held.
00949 // For other platforms, this is the nesting mutex that guards the
00950 // ACE_recursive_mutex_t internals, and recursive_mutex_cond_unlock()
00951 // returned with the lock held, but waiters primed and waiting to be
00952 // released. At cond_wait below, the mutex will be released.
00953 // On return, it will be reacquired.
00954 const int result = abstime == 0
00955 ? ACE_OS::cond_wait (&this->cond_,
00956 &mutex.get_nesting_mutex ())
00957 : ACE_OS::cond_timedwait (&this->cond_,
00958 &mutex.get_nesting_mutex (),
00959 (ACE_Time_Value *) abstime);
00960 // We are holding the mutex, whether the wait succeeded or failed.
00961 // Stash errno (in case it failed) and then we need to reset the
00962 // recursive mutex state to what it was on entry to this method.
00963 // Resetting it may require a wait for another thread to release
00964 // the ACE_recursive_thread_mutex_t if this is a platform without
00965 // ACE_HAS_RECURSIVE_MUTEXES, and recursive_mutex_cond_relock() takes
00966 // care of that.
00967 {
00968 ACE_Errno_Guard error (errno);
00969 ACE_OS::recursive_mutex_cond_relock (&recursive_mutex,
00970 mutex_state_holder);
00971 }
00972
00973 return result;
00974 }
|
|
|
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 928 of file Synch.cpp. References ACE_Condition::wait.
00929 {
00930 return this->wait (this->mutex_, abstime);
00931 }
|
|
|
A normal (i.e., non-recursive) condition variable.
|
|
|
Reference to the recursive mutex.
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002