MySQL 8.1.0
Source Code Documentation
lock0iter.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 2007, 2023, 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 also distributed with certain software (including but not
10limited to OpenSSL) that is licensed under separate terms, as designated in a
11particular file or component or in included license documentation. The authors
12of MySQL hereby grant you an additional permission to link the program and
13your derivative works with the separately licensed software that they have
14included with MySQL.
15
16This program is distributed in the hope that it will be useful, but WITHOUT
17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19for more details.
20
21You should have received a copy of the GNU General Public License along with
22this program; if not, write to the Free Software Foundation, Inc.,
2351 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
25*****************************************************************************/
26
27/** @file include/lock0iter.h
28 Lock queue iterator type and function prototypes.
29
30 Created July 16, 2007 Vasil Dimov
31 *******************************************************/
32
33#ifndef lock0iter_h
34#define lock0iter_h
35
36#include "lock0types.h"
37#include "univ.i"
38
41 /* In case this is a record lock queue (not table lock queue)
42 then bit_no is the record number within the heap in which the
43 record is stored. */
45};
46
47/** Initialize lock queue iterator so that it starts to iterate from
48 "lock". bit_no specifies the record number within the heap where the
49 record is stored. It can be undefined (ULINT_UNDEFINED) in two cases:
50 1. If the lock is a table lock, thus we have a table lock queue;
51 2. If the lock is a record lock and it is a wait lock. In this case
52 bit_no is calculated in this function by using
53 lock_rec_find_set_bit(). There is exactly one bit set in the bitmap
54 of a wait lock. */
56 lock_queue_iterator_t *iter, /*!< out: iterator */
57 const lock_t *lock, /*!< in: lock to start from */
58 ulint bit_no); /*!< in: record number in the
59 heap */
60
61/** Gets the previous lock in the lock queue, returns NULL if there are no
62 more locks (i.e. the current lock is the first one). The iterator is
63 receded (if not-NULL is returned).
64 @return previous lock or NULL */
66 lock_queue_iterator_t *iter); /*!< in/out: iterator */
67
68#endif /* lock0iter_h */
void lock_queue_iterator_reset(lock_queue_iterator_t *iter, const lock_t *lock, ulint bit_no)
Initialize lock queue iterator so that it starts to iterate from "lock".
Definition: lock0iter.cc:52
const lock_t * lock_queue_iterator_get_prev(lock_queue_iterator_t *iter)
Gets the previous lock in the lock queue, returns NULL if there are no more locks (i....
Definition: lock0iter.cc:84
The transaction lock system global types.
Provides atomic access in shared-exclusive modes.
Definition: shared_spin_lock.h:78
Definition: lock0iter.h:39
ulint bit_no
Definition: lock0iter.h:44
const lock_t * current_lock
Definition: lock0iter.h:40
Lock struct; protected by lock_sys latches.
Definition: lock0priv.h:135
Version control for database, common definitions, and include files.
unsigned long int ulint
Definition: univ.i:405