3 //=============================================================================
7 * @author From ACE to TAO by Balachandran Natarajan <bala@cs.wustl.edu>
9 //=============================================================================
11 #ifndef TAO_CONDITION_H
12 #define TAO_CONDITION_H
14 #include /**/ "ace/pre.h"
16 #include "tao/orbconf.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/Condition_T.h"
23 #include "ace/Global_Macros.h"
25 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
27 ACE_END_VERSIONED_NAMESPACE_DECL
29 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
32 * @class TAO_Condition
34 * @brief Same as to the ACE_Condition variable wrapper
36 * This class differs from ACE_Condition in that it uses a
37 * TAO_SYNCH_CONDITION instead of ACE_cond_t under the hood to
40 template <class MUTEX
>
47 // = Initialiation and termination methods.
48 /// Initialize the condition variable.
49 TAO_Condition (MUTEX
&m
);
51 /// A default constructor. Since no lock is provided by the user,
52 /// one will be created internally.
55 /// Implicitly destroy the condition variable.
60 * Block on condition, or until absolute time-of-day has passed. If
61 * abstime == 0 use "blocking" <wait> semantics. Else, if <abstime>
62 * != 0 and the call times out before the condition is signaled
63 * <wait> returns -1 and sets errno to ETIME.
65 int wait (const ACE_Time_Value
*abstime
);
67 /// Block on condition.
71 * Block on condition or until absolute time-of-day has passed. If
72 * abstime == 0 use "blocking" wait() semantics on the <mutex>
73 * passed as a parameter (this is useful if you need to store the
74 * <Condition> in shared memory). Else, if <abstime> != 0 and the
75 * call times out before the condition is signaled <wait> returns -1
76 * and sets errno to ETIME.
78 int wait (MUTEX
&mutex
, const ACE_Time_Value
*abstime
= 0);
80 /// Signal one waiting thread.
83 /// Signal *all* waiting threads.
87 /// Explicitly destroy the condition variable.
90 /// Returns a reference to the underlying mutex_;
94 TAO_Condition (const TAO_Condition
<MUTEX
> &) = delete;
95 TAO_Condition
&operator= (const TAO_Condition
<MUTEX
> &) = delete;
97 /// Reference to mutex lock.
100 /// A flag to indicate whether the lock needs to be deleted.
103 /// Condition variable.
104 TAO_SYNCH_CONDITION
*cond_
;
107 TAO_END_VERSIONED_NAMESPACE_DECL
109 #if defined (__ACE_INLINE__)
110 #include "tao/Condition.inl"
111 #endif /* __ACE_INLINE__ */
113 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
114 #include "tao/Condition.cpp"
115 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
117 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
118 #pragma implementation ("Condition.cpp")
119 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
121 #include /**/ "ace/post.h"
122 #endif /*TAO_CONDITION_H*/