3 * @file Condition_Thread_Mutex.cpp
5 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 #include "ace/Condition_Thread_Mutex.h"
10 #if defined (ACE_HAS_THREADS)
12 #if !defined (__ACE_INLINE__)
13 #include "ace/Condition_Thread_Mutex.inl"
14 #endif /* __ACE_INLINE__ */
16 #include "ace/Log_Category.h"
18 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
20 ACE_ALLOC_HOOK_DEFINE(ACE_Condition
<ACE_Thread_Mutex
>)
23 ACE_Condition
<ACE_Thread_Mutex
>::dump () const
25 #if defined (ACE_HAS_DUMP)
26 // ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::dump");
28 ACELIB_DEBUG ((LM_DEBUG
, ACE_BEGIN_DUMP
, this));
29 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("\n")));
30 #if defined (ACE_WIN32)
31 ACELIB_DEBUG ((LM_DEBUG
,
32 ACE_TEXT ("waiters = %d\n"),
33 this->cond_
.waiters ()));
34 #endif /* ACE_WIN32 */
35 ACELIB_DEBUG ((LM_DEBUG
, ACE_END_DUMP
));
36 #endif /* ACE_HAS_DUMP */
39 ACE_Condition
<ACE_Thread_Mutex
>::ACE_Condition (ACE_Thread_Mutex
&m
,
40 const ACE_TCHAR
*name
,
45 // ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::ACE_Condition<ACE_Thread_Mutex>");
46 if (ACE_OS::cond_init (&this->cond_
,
50 ACELIB_ERROR ((LM_ERROR
,
52 ACE_TEXT ("ACE_Condition<ACE_Thread_Mutex>::ACE_Condition<ACE_Thread_Mutex>")));
55 ACE_Condition
<ACE_Thread_Mutex
>::ACE_Condition (ACE_Thread_Mutex
&m
,
56 const ACE_Condition_Attributes
&attributes
,
57 const ACE_TCHAR
*name
,
62 // ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::ACE_Condition<ACE_Thread_Mutex>");
63 if (ACE_OS::cond_init (&this->cond_
,
64 const_cast<ACE_condattr_t
&> (attributes
.attributes ()),
66 ACELIB_ERROR ((LM_ERROR
, ACE_TEXT ("%p\n"),
67 ACE_TEXT ("ACE_Condition<ACE_Thread_Mutex>::ACE_Condition<ACE_Thread_Mutex>")));
70 ACE_Condition
<ACE_Thread_Mutex
>::~ACE_Condition ()
72 // ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::~ACE_Condition<ACE_Thread_Mutex>");
76 // Peform an "alertable" timed wait. If the argument <abstime> == 0
77 // then we do a regular <cond_wait>, else we do a timed wait for up to
78 // <abstime> using the <cond_timedwait> function.
81 ACE_Condition
<ACE_Thread_Mutex
>::wait ()
83 // ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::wait");
84 return ACE_OS::cond_wait (&this->cond_
, &this->mutex_
.lock ());
88 ACE_Condition
<ACE_Thread_Mutex
>::wait (ACE_Thread_Mutex
&mutex
,
89 const ACE_Time_Value
*abstime
)
91 // ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::wait");
92 return ACE_OS::cond_timedwait (&this->cond_
,
94 const_cast <ACE_Time_Value
*> (abstime
));
98 ACE_Condition
<ACE_Thread_Mutex
>::wait (const ACE_Time_Value
*abstime
)
100 // ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::wait");
101 return this->wait (this->mutex_
, abstime
);
105 ACE_Condition
<ACE_Thread_Mutex
>::signal ()
107 // ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::signal");
108 return ACE_OS::cond_signal (&this->cond_
);
112 ACE_Condition
<ACE_Thread_Mutex
>::broadcast ()
114 // ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::broadcast");
115 return ACE_OS::cond_broadcast (&this->cond_
);
118 ACE_END_VERSIONED_NAMESPACE_DECL
120 #endif /* ACE_HAS_THREADS */