1
/*****************************************************************************
3
Copyright (C) 2007, 2009, Innobase Oy. All Rights Reserved.
5
This program is free software; you can redistribute it and/or modify it under
6
the terms of the GNU General Public License as published by the Free Software
7
Foundation; version 2 of the License.
9
This program is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License along with
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
17
*****************************************************************************/
19
/**************************************************//**
20
@file include/lock0iter.h
21
Lock queue iterator type and function prototypes.
23
Created July 16, 2007 Vasil Dimov
24
*******************************************************/
30
#include "lock0types.h"
32
typedef struct lock_queue_iterator_struct {
33
const lock_t* current_lock;
34
/* In case this is a record lock queue (not table lock queue)
35
then bit_no is the record number within the heap in which the
38
} lock_queue_iterator_t;
40
/*******************************************************************//**
41
Initialize lock queue iterator so that it starts to iterate from
42
"lock". bit_no specifies the record number within the heap where the
43
record is stored. It can be undefined (ULINT_UNDEFINED) in two cases:
44
1. If the lock is a table lock, thus we have a table lock queue;
45
2. If the lock is a record lock and it is a wait lock. In this case
46
bit_no is calculated in this function by using
47
lock_rec_find_set_bit(). There is exactly one bit set in the bitmap
51
lock_queue_iterator_reset(
52
/*======================*/
53
lock_queue_iterator_t* iter, /*!< out: iterator */
54
const lock_t* lock, /*!< in: lock to start from */
55
ulint bit_no);/*!< in: record number in the
58
/*******************************************************************//**
59
Gets the previous lock in the lock queue, returns NULL if there are no
60
more locks (i.e. the current lock is the first one). The iterator is
61
receded (if not-NULL is returned).
62
@return previous lock or NULL */
65
lock_queue_iterator_get_prev(
66
/*=========================*/
67
lock_queue_iterator_t* iter); /*!< in/out: iterator */
69
#endif /* lock0iter_h */