[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / dep / ACE_wrappers / ace / Null_Mutex.h
blob5c8f6f6da0de687741a520108a462f978d8fd554
1 // -*- C++ -*-
3 //==========================================================================
4 /**
5 * @file Null_Mutex.h
7 * $Id: Null_Mutex.h 80826 2008-03-04 14:51:23Z wotte $
9 * Moved from Synch.h.
11 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
13 //==========================================================================
15 #ifndef ACE_NULL_MUTEX_H
16 #define ACE_NULL_MUTEX_H
17 #include /**/ "ace/pre.h"
19 // All methods in this class are inline, so there is no
20 // need to import or export on Windows. -- CAE 12/18/2003
21 // Update... leaving off the ACE_Export causes compile warnings in some
22 // cases with Microsoft Visual Studio .NET 2005, so I added the ACE_Export
23 // to these class declarations. Steve Huston, 12/8/2006.
25 #include "ace/os_include/os_errno.h"
27 #if !defined (ACE_LACKS_PRAGMA_ONCE)
28 # pragma once
29 #endif /* ACE_LACKS_PRAGMA_ONCE */
31 #include "ace/Global_Macros.h"
32 #include "ace/OS_Memory.h"
35 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
37 class ACE_Time_Value;
39 /**
40 * @class ACE_Null_Mutex
42 * @brief Implement a do nothing ACE_Mutex, i.e., all the methods are
43 * no ops.
45 class ACE_Export ACE_Null_Mutex
47 public:
48 ACE_Null_Mutex (const ACE_TCHAR * = 0)
49 : lock_ (0) {}
50 ~ACE_Null_Mutex (void) {}
51 /// Return 0.
52 int remove (void) {return 0;}
54 /// Return 0.
55 int acquire (void) {return 0;}
57 /// Return -1 with @c errno == @c ETIME.
58 int acquire (ACE_Time_Value &) {errno = ETIME; return -1;}
60 /// Return -1 with @c errno == @c ETIME.
61 int acquire (ACE_Time_Value *) {errno = ETIME; return -1;}
63 /// Return 0.
64 int tryacquire (void) {return 0;}
66 /// Return 0.
67 int release (void) {return 0;}
69 /// Return 0.
70 int acquire_write (void) {return 0;}
72 /// Return 0.
73 int tryacquire_write (void) {return 0;}
75 /// Return 0.
76 int tryacquire_write_upgrade (void) {return 0;}
78 /// Return 0.
79 int acquire_read (void) {return 0;}
81 /// Return 0.
82 int tryacquire_read (void) {return 0;}
84 /// Dump the state of an object.
85 void dump (void) const {}
87 /// Declare the dynamic allocation hooks.
88 //ACE_ALLOC_HOOK_DECLARE;
90 int lock_; // A dummy lock.
93 #if defined (ACE_USES_OBSOLETE_GUARD_CLASSES)
94 /**
95 * @class ACE_Null_Mutex_Guard
97 * @brief This data structure is meant to be used within a method or
98 * function... It performs automatic aquisition and release of
99 * an ACE_Null_Mutex.
101 * This class is obsolete and should be replaced by
102 * ACE_Guard<ACE_Null_Mutex>.
104 class ACE_Export ACE_Null_Mutex_Guard
106 public:
107 ACE_Null_Mutex_Guard (ACE_Null_Mutex &) {}
108 ~ACE_Null_Mutex_Guard (void) {}
109 int remove (void) {return 0;}
110 int locked (void) {return 1;}
111 int acquire (void) {return 0;}
112 int tryacquire (void) {return 0;}
113 int release (void) {return 0:}
114 void dump (void) const {}
116 private:
117 // = Prevent assignment and initialization.
118 void operator= (const ACE_Null_Mutex_Guard &);
119 ACE_Null_Mutex_Guard (const ACE_Null_Mutex_Guard &);
121 #endif /* ACE_USES_OBSOLETE_GUARD_CLASSES */
123 template <class ACE_LOCK>
124 class ACE_Guard;
127 * @class ACE_Guard<ACE_Null_Mutex>
129 * @brief Template specialization of ACE_Guard for the
130 * ACE_Null_Mutex.
132 * This specialization is useful since it helps to speedup
133 * performance of the "Null_Mutex" considerably.
135 template<>
136 class ACE_Export ACE_Guard<ACE_Null_Mutex>
138 public:
139 // = Initialization and termination methods.
140 ACE_Guard (ACE_Null_Mutex &) {}
141 ACE_Guard (ACE_Null_Mutex &, int) {}
142 ACE_Guard (ACE_Null_Mutex &, int, int) {}
143 #if defined (ACE_WIN32)
144 ~ACE_Guard (void) {}
145 #endif /* ACE_WIN32 */
147 int acquire (void) { return 0; }
148 int tryacquire (void) { return 0; }
149 int release (void) { return 0; }
150 void disown (void) {}
151 int locked (void) { return 1; }
152 int remove (void) { return 0; }
153 void dump (void) const {}
155 private:
157 // Disallow copying and assignment.
158 ACE_Guard (const ACE_Guard<ACE_Null_Mutex> &);
159 void operator= (const ACE_Guard<ACE_Null_Mutex> &);
163 template <class ACE_LOCK>
164 class ACE_Write_Guard;
167 * @class ACE_Write_Guard<ACE_Null_Mutex>
170 template<>
171 class ACE_Export ACE_Write_Guard<ACE_Null_Mutex>
172 : public ACE_Guard<ACE_Null_Mutex>
174 public:
175 ACE_Write_Guard (ACE_Null_Mutex &m)
176 : ACE_Guard<ACE_Null_Mutex> (m) {}
177 ACE_Write_Guard (ACE_Null_Mutex &m, int blocked)
178 : ACE_Guard<ACE_Null_Mutex> (m, blocked) {}
180 int acquire_write (void) { return 0; }
181 int acquire (void) { return 0; }
182 int tryacquire_write (void) { return 0; }
183 int tryacquire (void) { return 0; }
184 void dump (void) const {}
187 template <class ACE_LOCK>
188 class ACE_Read_Guard;
191 * @class ACE_Read_Guard<ACE_Null_Mutex>
194 template<>
195 class ACE_Export ACE_Read_Guard<ACE_Null_Mutex>
196 : public ACE_Guard<ACE_Null_Mutex>
198 public:
199 ACE_Read_Guard (ACE_Null_Mutex &m)
200 : ACE_Guard<ACE_Null_Mutex> (m) {}
201 ACE_Read_Guard (ACE_Null_Mutex &m, int blocked)
202 : ACE_Guard<ACE_Null_Mutex> (m, blocked) {}
204 int acquire_read (void) { return 0; }
205 int acquire (void) { return 0; }
206 int tryacquire_read (void) { return 0; }
207 int tryacquire (void) { return 0; }
208 void dump (void) const {}
211 template <class T> class ACE_Malloc_Lock_Adapter_T;
214 * @class ACE_Malloc_Lock_Adapter_T<ACE_Null_Mutex>
217 template<>
218 class ACE_Export ACE_Malloc_Lock_Adapter_T<ACE_Null_Mutex>
220 public:
221 ACE_Null_Mutex * operator () (const ACE_TCHAR *name)
223 ACE_Null_Mutex *p;
224 ACE_NEW_RETURN (p, ACE_Null_Mutex (name), 0);
225 return p;
229 ACE_END_VERSIONED_NAMESPACE_DECL
231 #include /**/ "ace/post.h"
232 #endif /* ACE_NULL_MUTEX_H */