MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UtilLock.hpp
1 /*
2  Copyright (C) 2003-2007 MySQL AB
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #ifndef UTIL_LOCK_HPP
20 #define UTIL_LOCK_HPP
21 
22 #include "SignalData.hpp"
23 
24 class UtilLockReq {
25 
29  friend class DbUtil;
30 
34  friend class Dbdih;
35  friend class MutexManager;
36 
37  friend bool printUTIL_LOCK_REQ(FILE *, const Uint32 *, Uint32, Uint16);
38 public:
39  STATIC_CONST( SignalLength = 5 );
40 
41  enum RequestInfo {
42  TryLock = 1,
43  SharedLock = 2,
44  Notify = 4,
45  Granted = 8
46  };
47 
48 public:
49  Uint32 senderData;
50  Uint32 senderRef;
51  Uint32 lockId;
52  Uint32 requestInfo;
53  Uint32 extra;
54 };
55 
56 class UtilLockConf {
57 
61  friend class Dbdih;
62  friend class MutexManager;
63 
67  friend class DbUtil;
68 
69  friend bool printUTIL_LOCK_CONF(FILE *, const Uint32 *, Uint32, Uint16);
70 public:
71  STATIC_CONST( SignalLength = 4 );
72 
73 public:
74  Uint32 senderData;
75  Uint32 senderRef;
76  Uint32 lockId;
77  Uint32 extra;
78 };
79 
80 class UtilLockRef {
81 
85  friend class Dbdih;
86  friend class MutexManager;
87 
91  friend class DbUtil;
92 
93  friend bool printUTIL_LOCK_REF(FILE *, const Uint32 *, Uint32, Uint16);
94 public:
95  STATIC_CONST( SignalLength = 5 );
96 
97  enum ErrorCode {
98  OK = 0,
99  NoSuchLock = 1,
100  OutOfLockRecords = 2,
101  DistributedLockNotSupported = 3,
102  LockAlreadyHeld = 4,
103  InLockQueue = 5 // lock + notify
104  };
105 public:
106 
107  Uint32 senderData;
108  Uint32 senderRef;
109  Uint32 lockId;
110  Uint32 errorCode;
111  Uint32 extra;
112 };
113 
115 
119  friend class DbUtil;
120 
124  friend class Dbdih;
125  friend class MutexManager;
126 
127  friend bool printUTIL_UNLOCK_REQ(FILE *, const Uint32 *, Uint32, Uint16);
128 public:
129  STATIC_CONST( SignalLength = 3 );
130 
131 public:
132  Uint32 senderData;
133  Uint32 senderRef;
134  Uint32 lockId;
135 };
136 
138 
142  friend class Dbdih;
143  friend class MutexManager;
144 
148  friend class DbUtil;
149 
150  friend bool printUTIL_UNLOCK_CONF(FILE *, const Uint32 *, Uint32, Uint16);
151 public:
152  STATIC_CONST( SignalLength = 3 );
153 
154 public:
155  Uint32 senderData;
156  Uint32 senderRef;
157  Uint32 lockId;
158 };
159 
161 
165  friend class Dbdih;
166  friend class MutexManager;
167 
171  friend class DbUtil;
172 
173  friend bool printUTIL_UNLOCK_REF(FILE *, const Uint32 *, Uint32, Uint16);
174 public:
175  STATIC_CONST( SignalLength = 4 );
176 
177  enum ErrorCode {
178  OK = 0,
179  NoSuchLock = 1,
180  NotLockOwner = 2,
181  NotInLockQueue = 3
182  };
183 public:
184  Uint32 senderData;
185  Uint32 senderRef;
186  Uint32 lockId;
187  Uint32 errorCode;
188 };
189 
197  friend class DbUtil;
198 
202  friend class MutexManager;
203 
204  friend bool printUTIL_CREATE_LOCK_REQ(FILE *, const Uint32*, Uint32, Uint16);
205 public:
206  enum LockType {
207  Mutex = 0 // Lock with only exclusive locks
208  };
209 
210  STATIC_CONST( SignalLength = 4 );
211 
212 public:
213  Uint32 senderData;
214  Uint32 senderRef;
215  Uint32 lockId;
216  Uint32 lockType;
217 };
218 
223  friend class DbUtil;
224 
228  friend class MutexManager;
229 
230  friend bool printUTIL_CREATE_LOCK_REF(FILE *, const Uint32*, Uint32, Uint16);
231 public:
232  enum ErrorCode {
233  OK = 0,
234  OutOfLockQueueRecords = 1,
235  LockIdAlreadyUsed = 2,
236  UnsupportedLockType = 3
237  };
238 
239  STATIC_CONST( SignalLength = 4 );
240 
241 public:
242  Uint32 senderData;
243  Uint32 senderRef;
244  Uint32 lockId;
245  Uint32 errorCode;
246 };
247 
252  friend class DbUtil;
253 
257  friend class MutexManager;
258 
259  friend bool printUTIL_CREATE_LOCK_CONF(FILE*, const Uint32*, Uint32, Uint16);
260 public:
261  STATIC_CONST( SignalLength = 3 );
262 
263 public:
264  Uint32 senderData;
265  Uint32 senderRef;
266  Uint32 lockId;
267 };
268 
276  friend class DbUtil;
277 
281  friend class MutexManager;
282 
283  friend bool printUTIL_DESTROY_LOCK_REQ(FILE *, const Uint32*, Uint32, Uint16);
284 public:
285  STATIC_CONST( SignalLength = 4 );
286 
287 public:
288  Uint32 senderData;
289  Uint32 senderRef;
290  Uint32 lockId;
291 };
292 
297  friend class DbUtil;
298 
302  friend class MutexManager;
303 
304  friend bool printUTIL_DESTROY_LOCK_REF(FILE *, const Uint32*, Uint32, Uint16);
305 public:
306  enum ErrorCode {
307  OK = 0,
308  NoSuchLock = 1,
309  NotLockOwner = 2
310  };
311 
312  STATIC_CONST( SignalLength = 4 );
313 
314 public:
315  Uint32 senderData;
316  Uint32 senderRef;
317  Uint32 lockId;
318  Uint32 errorCode;
319 };
320 
325  friend class DbUtil;
326 
330  friend class MutexManager;
331 
332  friend bool printUTIL_DESTROY_LOCK_CONF(FILE*, const Uint32*, Uint32, Uint16);
333 public:
334  STATIC_CONST( SignalLength = 3 );
335 
336 public:
337  Uint32 senderData;
338  Uint32 senderRef;
339  Uint32 lockId;
340 };
341 
342 #endif