Fixed typos
[ACE_TAO.git] / ACE / ace / Condition_Recursive_Thread_Mutex.h
blobf53ab12ebfd739c5bac6fe74cbe7c1456a08a90e
1 // -*- C++ -*-
3 //==========================================================================
4 /**
5 * @file Condition_Recursive_Thread_Mutex.h
7 * Moved from Synch.h.
9 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
11 //==========================================================================
13 #ifndef ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H
14 #define ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H
15 #include /**/ "ace/pre.h"
17 #include /**/ "ace/ACE_export.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #if !defined (ACE_HAS_THREADS)
24 # include "ace/Null_Condition.h"
25 #else /* ACE_HAS_THREADS */
26 #include "ace/Recursive_Thread_Mutex.h"
27 #include "ace/Condition_Attributes.h"
28 #include "ace/Condition_T.h"
30 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
32 /**
33 * @brief ACE_Condition template specialization written using
34 * @a ACE_Recursive_Thread_Mutex. This allows threads to block until
35 * shared data changes state using recursive mutexes.
37 template<>
38 class ACE_Export ACE_Condition<ACE_Recursive_Thread_Mutex>
40 public:
41 /// Initialize the condition variable with a recursive mutex.
42 ACE_Condition (ACE_Recursive_Thread_Mutex &m);
44 /// Initialize the condition variable.
45 ACE_Condition (ACE_Recursive_Thread_Mutex &m,
46 const ACE_Condition_Attributes &attributes);
48 /// Implicitly destroy the condition variable.
49 ~ACE_Condition (void);
51 /**
52 * Explicitly destroy the condition variable. Note that only one
53 * thread should call this method since it doesn't protect against
54 * race conditions.
56 int remove (void);
58 /**
59 * Block on condition, or until absolute time-of-day has passed. If
60 * abstime == 0 use "blocking" <wait> semantics. Else, if @a 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);
66 /**
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 @a 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.
78 int signal (void);
80 /// Signal *all* waiting threads.
81 int broadcast (void);
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;
89 private:
90 // = Prevent assignment and copying.
91 void operator= (const ACE_Condition<ACE_Recursive_Thread_Mutex> &);
92 ACE_Condition (const ACE_Condition<ACE_Recursive_Thread_Mutex> &);
94 private:
95 /// A normal (i.e., non-recursive) condition variable.
96 ACE_cond_t cond_;
98 /// Reference to the recursive mutex.
99 ACE_Recursive_Thread_Mutex &mutex_;
102 typedef ACE_Condition<ACE_Recursive_Thread_Mutex> ACE_Condition_Recursive_Thread_Mutex;
104 ACE_END_VERSIONED_NAMESPACE_DECL
106 #endif /* !ACE_HAS_THREADS */
108 #include /**/ "ace/post.h"
109 #endif /* ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H */