3 //==========================================================================
5 * @file Condition_Recursive_Thread_Mutex.h
7 * $Id: Condition_Recursive_Thread_Mutex.h 80826 2008-03-04 14:51:23Z wotte $
11 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
13 //==========================================================================
15 #ifndef ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H
16 #define ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H
17 #include /**/ "ace/pre.h"
19 #include /**/ "ace/ACE_export.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #if !defined (ACE_HAS_THREADS)
26 # include "ace/Null_Condition.h"
27 #else /* ACE_HAS_THREADS */
28 #include "ace/Recursive_Thread_Mutex.h"
30 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
32 template <class ACE_LOCK
> class ACE_Condition
;
35 * @class ACE_Condition<ACE_Recursive_Thread_Mutex>
37 * @brief ACE_Condition template specialization written using
38 * @a ACE_Recursive_Thread_Mutex. This allows threads to block until
39 * shared data changes state using recursive mutexes.
42 class ACE_Export ACE_Condition
<ACE_Recursive_Thread_Mutex
>
45 /// Initialize the condition variable with a recursive mutex.
46 ACE_Condition (ACE_Recursive_Thread_Mutex
&m
);
48 /// Implicitly destroy the condition variable.
49 ~ACE_Condition (void);
52 * Explicitly destroy the condition variable. Note that only one
53 * thread should call this method since it doesn't protect against
59 * Block on condition, or until absolute time-of-day has passed. If
60 * abstime == 0 use "blocking" <wait> semantics. Else, if <abstime>
61 * != 0 and the call times out before the condition is signaled
62 * <wait> returns -1 and sets errno to ETIME.
64 int wait (const ACE_Time_Value
*abstime
= 0);
67 * Block on condition or until absolute time-of-day has passed. If
68 * abstime == 0 use "blocking" wait() semantics on the recursive @a mutex
69 * passed as a parameter (this is useful if you need to store the
70 * <Condition> in shared memory). Else, if <abstime> != 0 and the
71 * call times out before the condition is signaled <wait> returns -1
72 * and sets errno to ETIME.
74 int wait (ACE_Recursive_Thread_Mutex
&mutex
,
75 const ACE_Time_Value
*abstime
= 0);
77 /// Signal one waiting thread.
80 /// Signal *all* waiting threads.
83 /// Returns a reference to the underlying mutex;
84 ACE_Recursive_Thread_Mutex
&mutex (void);
86 /// Dump the state of an object.
87 void dump (void) const;
91 // = Prevent assignment and copying.
92 void operator= (const ACE_Condition
<ACE_Recursive_Thread_Mutex
> &);
93 ACE_Condition (const ACE_Condition
<ACE_Recursive_Thread_Mutex
> &);
97 /// A normal (i.e., non-recursive) condition variable.
100 /// Reference to the recursive mutex.
101 ACE_Recursive_Thread_Mutex
&mutex_
;
105 class ACE_Export ACE_Condition_Recursive_Thread_Mutex
106 : public ACE_Condition
<ACE_Recursive_Thread_Mutex
>
109 /// Initialize the condition variable with a recursive mutex.
110 ACE_Condition_Recursive_Thread_Mutex (ACE_Recursive_Thread_Mutex
&m
);
113 ACE_END_VERSIONED_NAMESPACE_DECL
115 #endif /* !ACE_HAS_THREADS */
117 #include /**/ "ace/post.h"
118 #endif /* ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H */