~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
/******************************************************
2
Lock queue iterator type and function prototypes.
3
4
(c) 2007 Innobase Oy
5
6
Created July 16, 2007 Vasil Dimov
7
*******************************************************/
8
9
#ifndef lock0iter_h
10
#define lock0iter_h
11
12
#include "univ.i"
13
#include "lock0types.h"
14
15
typedef struct lock_queue_iterator_struct {
16
	lock_t*	current_lock;
17
	/* In case this is a record lock queue (not table lock queue)
18
	then bit_no is the record number within the heap in which the
19
	record is stored. */
20
	ulint	bit_no;
21
} lock_queue_iterator_t;
22
23
/***********************************************************************
24
Initialize lock queue iterator so that it starts to iterate from
25
"lock". bit_no specifies the record number within the heap where the
26
record is stored. It can be undefined (ULINT_UNDEFINED) in two cases:
27
1. If the lock is a table lock, thus we have a table lock queue;
28
2. If the lock is a record lock and it is a wait lock. In this case
29
   bit_no is calculated in this function by using
30
   lock_rec_find_set_bit(). There is exactly one bit set in the bitmap
31
   of a wait lock. */
32
33
void
34
lock_queue_iterator_reset(
35
/*======================*/
36
	lock_queue_iterator_t*	iter,	/* out: iterator */
37
	lock_t*			lock,	/* in: lock to start from */
38
	ulint			bit_no);/* in: record number in the
39
					heap */
40
41
/***********************************************************************
42
Gets the previous lock in the lock queue, returns NULL if there are no
43
more locks (i.e. the current lock is the first one). The iterator is
44
receded (if not-NULL is returned). */
45
46
lock_t*
47
lock_queue_iterator_get_prev(
48
/*=========================*/
49
					/* out: previous lock or NULL */
50
	lock_queue_iterator_t*	iter);	/* in/out: iterator */
51
52
#endif /* lock0iter_h */