Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / ACE / ace / Null_Condition.h
blob8f699a1988e36ed648575b41aa0f7d046d7928a2
1 // -*- C++ -*-
3 //==========================================================================
4 /**
5 * @file Null_Condition.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 */
9 //==========================================================================
11 #ifndef ACE_NULL_CONDITION_H
12 #define ACE_NULL_CONDITION_H
13 #include /**/ "ace/pre.h"
15 #include "ace/Null_Mutex.h"
16 #include "ace/Condition_T.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/os_include/os_errno.h"
24 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 class ACE_Time_Value;
27 class ACE_Condition_Attributes;
28 template <class MUTEX> class ACE_Condition;
30 /**
31 * @brief ACE_Condition template specialization written using
32 * ACE_Null_Mutexes. Implements a do nothing ACE_Condition
33 * specialization, i.e., all methods are no ops.
35 template <>
36 class ACE_Condition<ACE_Null_Mutex>
38 public:
39 ACE_Condition (const ACE_Null_Mutex &m,
40 const ACE_TCHAR * = 0,
41 void * = 0)
42 : mutex_ ((ACE_Null_Mutex &) m) {}
44 ACE_Condition (const ACE_Null_Mutex &m,
45 const ACE_Condition_Attributes &,
46 const ACE_TCHAR * = 0,
47 void * = 0)
48 : mutex_ ((ACE_Null_Mutex &) m) {}
50 ~ACE_Condition () = default;
52 /// Returns 0.
53 int remove () {return 0;}
55 /// Returns -1 with @c errno == @c ETIME.
56 int wait (const ACE_Time_Value * = 0) {errno = ETIME; return -1;}
58 /// Returns -1 with @c errno == @c ETIME.
59 int wait (ACE_Null_Mutex &,
60 const ACE_Time_Value * = 0) {errno = ETIME; return -1;}
62 /// Returns 0.
63 int signal () {return 0;}
65 /// Returns 0.
66 int broadcast () {return 0;}
67 ACE_Null_Mutex &mutex () {return this->mutex_;}
69 /// Dump the state of an object.
70 void dump () const {}
72 // ACE_ALLOC_HOOK_DECLARE;
73 // Declare the dynamic allocation hooks.
75 protected:
76 ACE_Null_Mutex &mutex_; // Reference to mutex lock.
78 private:
79 void operator= (const ACE_Condition<ACE_Null_Mutex> &) = delete;
80 ACE_Condition (const ACE_Condition<ACE_Null_Mutex> &) = delete;
83 typedef ACE_Condition<ACE_Null_Mutex> ACE_Null_Condition;
85 ACE_END_VERSIONED_NAMESPACE_DECL
87 #include /**/ "ace/post.h"
88 #endif /* ACE_NULL_CONDITION_H */