mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / storage / ndb / include / kernel / signaldata / UtilLock.hpp
blob153073e453ea06ae63e6348f47e287877cdc8f27
1 /* Copyright (c) 2003-2005 MySQL AB
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 #ifndef UTIL_LOCK_HPP
17 #define UTIL_LOCK_HPP
19 #include "SignalData.hpp"
21 class UtilLockReq {
23 /**
24 * Receiver
26 friend class DbUtil;
28 /**
29 * Sender
31 friend class Dbdih;
32 friend class MutexManager;
34 friend bool printUTIL_LOCK_REQ(FILE *, const Uint32 *, Uint32, Uint16);
35 public:
36 STATIC_CONST( SignalLength = 4 );
38 enum RequestInfo {
39 TryLock = 1
41 public:
42 Uint32 senderData;
43 Uint32 senderRef;
44 Uint32 lockId;
45 Uint32 requestInfo;
48 class UtilLockConf {
50 /**
51 * Receiver
53 friend class Dbdih;
54 friend class MutexManager;
56 /**
57 * Sender
59 friend class DbUtil;
61 friend bool printUTIL_LOCK_CONF(FILE *, const Uint32 *, Uint32, Uint16);
62 public:
63 STATIC_CONST( SignalLength = 4 );
65 public:
66 Uint32 senderData;
67 Uint32 senderRef;
68 Uint32 lockId;
69 Uint32 lockKey;
72 class UtilLockRef {
74 /**
75 * Reciver
77 friend class Dbdih;
78 friend class MutexManager;
80 /**
81 * Sender
83 friend class DbUtil;
85 friend bool printUTIL_LOCK_REF(FILE *, const Uint32 *, Uint32, Uint16);
86 public:
87 STATIC_CONST( SignalLength = 4 );
89 enum ErrorCode {
90 OK = 0,
91 NoSuchLock = 1,
92 OutOfLockRecords = 2,
93 DistributedLockNotSupported = 3,
94 LockAlreadyHeld = 4
97 public:
98 Uint32 senderData;
99 Uint32 senderRef;
100 Uint32 lockId;
101 Uint32 errorCode;
104 class UtilUnlockReq {
107 * Receiver
109 friend class DbUtil;
112 * Sender
114 friend class Dbdih;
115 friend class MutexManager;
117 friend bool printUTIL_UNLOCK_REQ(FILE *, const Uint32 *, Uint32, Uint16);
118 public:
119 STATIC_CONST( SignalLength = 4 );
121 public:
122 Uint32 senderData;
123 Uint32 senderRef;
124 Uint32 lockId;
125 Uint32 lockKey;
128 class UtilUnlockConf {
131 * Receiver
133 friend class Dbdih;
134 friend class MutexManager;
137 * Sender
139 friend class DbUtil;
141 friend bool printUTIL_UNLOCK_CONF(FILE *, const Uint32 *, Uint32, Uint16);
142 public:
143 STATIC_CONST( SignalLength = 3 );
145 public:
146 Uint32 senderData;
147 Uint32 senderRef;
148 Uint32 lockId;
151 class UtilUnlockRef {
154 * Reciver
156 friend class Dbdih;
157 friend class MutexManager;
160 * Sender
162 friend class DbUtil;
164 friend bool printUTIL_UNLOCK_REF(FILE *, const Uint32 *, Uint32, Uint16);
165 public:
166 STATIC_CONST( SignalLength = 4 );
168 enum ErrorCode {
169 OK = 0,
170 NoSuchLock = 1,
171 NotLockOwner = 2
173 public:
174 Uint32 senderData;
175 Uint32 senderRef;
176 Uint32 lockId;
177 Uint32 errorCode;
181 * Creating a lock
183 class UtilCreateLockReq {
185 * Receiver
187 friend class DbUtil;
190 * Sender
192 friend class MutexManager;
194 friend bool printUTIL_CREATE_LOCK_REQ(FILE *, const Uint32*, Uint32, Uint16);
195 public:
196 enum LockType {
197 Mutex = 0 // Lock with only exclusive locks
200 STATIC_CONST( SignalLength = 4 );
202 public:
203 Uint32 senderData;
204 Uint32 senderRef;
205 Uint32 lockId;
206 Uint32 lockType;
209 class UtilCreateLockRef {
211 * Sender
213 friend class DbUtil;
216 * Receiver
218 friend class MutexManager;
220 friend bool printUTIL_CREATE_LOCK_REF(FILE *, const Uint32*, Uint32, Uint16);
221 public:
222 enum ErrorCode {
223 OK = 0,
224 OutOfLockQueueRecords = 1,
225 LockIdAlreadyUsed = 2,
226 UnsupportedLockType = 3
229 STATIC_CONST( SignalLength = 4 );
231 public:
232 Uint32 senderData;
233 Uint32 senderRef;
234 Uint32 lockId;
235 Uint32 errorCode;
238 class UtilCreateLockConf {
240 * Sender
242 friend class DbUtil;
245 * Receiver
247 friend class MutexManager;
249 friend bool printUTIL_CREATE_LOCK_CONF(FILE*, const Uint32*, Uint32, Uint16);
250 public:
251 STATIC_CONST( SignalLength = 3 );
253 public:
254 Uint32 senderData;
255 Uint32 senderRef;
256 Uint32 lockId;
260 * Creating a lock
262 class UtilDestroyLockReq {
264 * Receiver
266 friend class DbUtil;
269 * Sender
271 friend class MutexManager;
273 friend bool printUTIL_DESTROY_LOCK_REQ(FILE *, const Uint32*, Uint32, Uint16);
274 public:
275 STATIC_CONST( SignalLength = 4 );
277 public:
278 Uint32 senderData;
279 Uint32 senderRef;
280 Uint32 lockId;
281 Uint32 lockKey;
284 class UtilDestroyLockRef {
286 * Sender
288 friend class DbUtil;
291 * Receiver
293 friend class MutexManager;
295 friend bool printUTIL_DESTROY_LOCK_REF(FILE *, const Uint32*, Uint32, Uint16);
296 public:
297 enum ErrorCode {
298 OK = 0,
299 NoSuchLock = 1,
300 NotLockOwner = 2
303 STATIC_CONST( SignalLength = 4 );
305 public:
306 Uint32 senderData;
307 Uint32 senderRef;
308 Uint32 lockId;
309 Uint32 errorCode;
312 class UtilDestroyLockConf {
314 * Sender
316 friend class DbUtil;
319 * Receiver
321 friend class MutexManager;
323 friend bool printUTIL_DESTROY_LOCK_CONF(FILE*, const Uint32*, Uint32, Uint16);
324 public:
325 STATIC_CONST( SignalLength = 3 );
327 public:
328 Uint32 senderData;
329 Uint32 senderRef;
330 Uint32 lockId;
333 #endif