~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/lock/lock0iter.c

  • Committer: Brian Aker
  • Date: 2009-01-24 09:43:35 UTC
  • Revision ID: brian@gir-3.local-20090124094335-6qdtvc35gl5fvivz
Adding in an example singe thread scheduler

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (c) 2007, 2009, Innobase Oy. All Rights Reserved.
4
 
 
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.
8
 
 
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.
12
 
 
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., 59 Temple
15
 
Place, Suite 330, Boston, MA 02111-1307 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/**************************************************//**
20
 
@file lock/lock0iter.c
 
1
/******************************************************
21
2
Lock queue iterator. Can iterate over table and record
22
3
lock queues.
23
4
 
 
5
(c) 2007 Innobase Oy
 
6
 
24
7
Created July 16, 2007 Vasil Dimov
25
8
*******************************************************/
26
9
 
32
15
#include "lock0priv.h"
33
16
#include "ut0dbg.h"
34
17
#include "ut0lst.h"
35
 
#ifdef UNIV_DEBUG
36
 
# include "srv0srv.h" /* kernel_mutex */
37
 
#endif /* UNIV_DEBUG */
38
18
 
39
 
/*******************************************************************//**
 
19
/***********************************************************************
40
20
Initialize lock queue iterator so that it starts to iterate from
41
21
"lock". bit_no specifies the record number within the heap where the
42
22
record is stored. It can be undefined (ULINT_UNDEFINED) in two cases:
49
29
void
50
30
lock_queue_iterator_reset(
51
31
/*======================*/
52
 
        lock_queue_iterator_t*  iter,   /*!< out: iterator */
53
 
        const lock_t*           lock,   /*!< in: lock to start from */
54
 
        ulint                   bit_no) /*!< in: record number in the
 
32
        lock_queue_iterator_t*  iter,   /* out: iterator */
 
33
        const lock_t*           lock,   /* in: lock to start from */
 
34
        ulint                   bit_no) /* in: record number in the
55
35
                                        heap */
56
36
{
57
 
        ut_ad(mutex_own(&kernel_mutex));
58
 
 
59
37
        iter->current_lock = lock;
60
38
 
61
39
        if (bit_no != ULINT_UNDEFINED) {
77
55
        }
78
56
}
79
57
 
80
 
/*******************************************************************//**
 
58
/***********************************************************************
81
59
Gets the previous lock in the lock queue, returns NULL if there are no
82
60
more locks (i.e. the current lock is the first one). The iterator is
83
 
receded (if not-NULL is returned).
84
 
@return previous lock or NULL */
 
61
receded (if not-NULL is returned). */
85
62
UNIV_INTERN
86
63
const lock_t*
87
64
lock_queue_iterator_get_prev(
88
65
/*=========================*/
89
 
        lock_queue_iterator_t*  iter)   /*!< in/out: iterator */
 
66
                                        /* out: previous lock or NULL */
 
67
        lock_queue_iterator_t*  iter)   /* in/out: iterator */
90
68
{
91
69
        const lock_t*   prev_lock;
92
70
 
93
 
        ut_ad(mutex_own(&kernel_mutex));
94
 
 
95
71
        switch (lock_get_type_low(iter->current_lock)) {
96
72
        case LOCK_REC:
97
73
                prev_lock = lock_rec_get_prev(