00001 // -*- C++ -*- 00002 // 00003 // Condition_Thread_Mutex.inl,v 4.2 2005/10/28 16:14:51 ossama Exp 00004 00005 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00006 00007 ACE_INLINE 00008 ACE_Condition_Attributes::ACE_Condition_Attributes (int type) 00009 { 00010 (void) ACE_OS::condattr_init (this->attributes_, type); 00011 } 00012 00013 ACE_INLINE 00014 ACE_Condition_Attributes::~ACE_Condition_Attributes (void) 00015 { 00016 ACE_OS::condattr_destroy (this->attributes_); 00017 } 00018 00019 ACE_INLINE int 00020 ACE_Condition_Thread_Mutex::remove (void) 00021 { 00022 // ACE_TRACE ("ACE_Condition_Thread_Mutex::remove"); 00023 00024 // <cond_destroy> is called in a loop if the condition variable is 00025 // BUSY. This avoids a condition where a condition is signaled and 00026 // because of some timing problem, the thread that is to be signaled 00027 // has called the cond_wait routine after the signal call. Since 00028 // the condition signal is not queued in any way, deadlock occurs. 00029 00030 int result = 0; 00031 00032 if (this->removed_ == 0) 00033 { 00034 this->removed_ = 1; 00035 00036 while ((result = ACE_OS::cond_destroy (&this->cond_)) == -1 00037 && errno == EBUSY) 00038 { 00039 ACE_OS::cond_broadcast (&this->cond_); 00040 ACE_OS::thr_yield (); 00041 } 00042 } 00043 return result; 00044 } 00045 00046 ACE_INLINE ACE_Thread_Mutex & 00047 ACE_Condition_Thread_Mutex::mutex (void) 00048 { 00049 // ACE_TRACE ("ACE_Condition_Thread_Mutex::mutex"); 00050 return this->mutex_; 00051 } 00052 00053 #if 0 00054 template <class MUTEX> void 00055 ACE_Process_Condition<MUTEX>::dump (void) const 00056 { 00057 #if defined (ACE_HAS_DUMP) 00058 // ACE_TRACE ("ACE_Process_Condition<MUTEX>::dump"); 00059 00060 ACE_Condition<MUTEX>::dump (); 00061 #endif /* ACE_HAS_DUMP */ 00062 } 00063 00064 template <class MUTEX> 00065 ACE_Process_Condition<MUTEX>::ACE_Process_Condition (MUTEX &m, 00066 const ACE_TCHAR *name, 00067 void *arg) 00068 : ACE_Condition<MUTEX> (m, USYNC_PROCESS, name, arg) 00069 { 00070 // ACE_TRACE ("ACE_Process_Condition<MUTEX>::ACE_Process_Condition"); 00071 } 00072 #endif /* 0 */ 00073 00074 ACE_END_VERSIONED_NAMESPACE_DECL