MySQL 8.4.2
Source Code Documentation
lock0types.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1996, 2024, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is designed to work with certain software (including
10but not limited to OpenSSL) that is licensed under separate terms,
11as designated in a particular file or component or in included license
12documentation. The authors of MySQL hereby grant you an additional
13permission to link the program and your derivative works with the
14separately licensed software that they have either included with
15the program or referenced in the documentation.
16
17This program is distributed in the hope that it will be useful, but WITHOUT
18ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20for more details.
21
22You should have received a copy of the GNU General Public License along with
23this program; if not, write to the Free Software Foundation, Inc.,
2451 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26*****************************************************************************/
27
28/** @file include/lock0types.h
29 The transaction lock system global types
30
31 Created 5/7/1996 Heikki Tuuri
32 *******************************************************/
33
34#include "univ.i"
35
36#ifndef lock0types_h
37#define lock0types_h
38
39#define lock_t ib_lock_t
40
41struct lock_t;
42struct lock_sys_t;
43struct lock_table_t;
44
46 SELECT_ORDINARY, /* default behaviour */
47 SELECT_SKIP_LOCKED, /* skip the row if row is locked */
48 SELECT_NOWAIT /* return immediately if row is locked */
49};
50
51/* Basic lock modes */
53 LOCK_IS = 0, /* intention shared */
54 LOCK_IX, /* intention exclusive */
55 LOCK_S, /* shared */
56 LOCK_X, /* exclusive */
57 LOCK_AUTO_INC, /* locks the auto-inc counter of a table
58 in an exclusive mode */
59 LOCK_NONE, /* this is used elsewhere to note consistent read */
60 LOCK_NUM = LOCK_NONE, /* number of lock modes */
61 LOCK_NONE_UNSET = 255
62};
63
64/** Convert the given enum value into string.
65@param[in] mode the lock mode
66@return human readable string of the given enum value */
67inline const char *lock_mode_string(enum lock_mode mode) {
68 switch (mode) {
69 case LOCK_IS:
70 return ("LOCK_IS");
71 case LOCK_IX:
72 return ("LOCK_IX");
73 case LOCK_S:
74 return ("LOCK_S");
75 case LOCK_X:
76 return ("LOCK_X");
77 case LOCK_AUTO_INC:
78 return ("LOCK_AUTO_INC");
79 case LOCK_NONE:
80 return ("LOCK_NONE");
81 case LOCK_NONE_UNSET:
82 return ("LOCK_NONE_UNSET");
83 default:
85 }
86}
87typedef UT_LIST_BASE_NODE_T_EXTERN(lock_t, trx_locks) trx_lock_list_t;
88
89typedef uint32_t trx_schedule_weight_t;
90#endif /* lock0types_h */
uint32_t trx_schedule_weight_t
Definition: lock0types.h:89
const char * lock_mode_string(enum lock_mode mode)
Convert the given enum value into string.
Definition: lock0types.h:67
typedef UT_LIST_BASE_NODE_T_EXTERN(lock_t, trx_locks) trx_lock_list_t
select_mode
Definition: lock0types.h:45
@ SELECT_SKIP_LOCKED
Definition: lock0types.h:47
@ SELECT_NOWAIT
Definition: lock0types.h:48
@ SELECT_ORDINARY
Definition: lock0types.h:46
lock_mode
Definition: lock0types.h:52
@ LOCK_NONE
Definition: lock0types.h:59
@ LOCK_IX
Definition: lock0types.h:54
@ LOCK_AUTO_INC
Definition: lock0types.h:57
@ LOCK_IS
Definition: lock0types.h:53
@ LOCK_S
Definition: lock0types.h:55
@ LOCK_NONE_UNSET
Definition: lock0types.h:61
@ LOCK_X
Definition: lock0types.h:56
@ LOCK_NUM
Definition: lock0types.h:60
mode
Definition: file_handle.h:61
The lock system struct.
Definition: lock0lock.h:1020
Lock struct; protected by lock_sys latches.
Definition: lock0priv.h:136
A table lock.
Definition: lock0priv.h:53
Version control for database, common definitions, and include files.
#define ut_error
Abort execution.
Definition: ut0dbg.h:101