~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/lock0priv.h

  • 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 include/lock0priv.h
 
1
/******************************************************
21
2
Lock module internal structures and methods.
22
3
 
 
4
(c) 2007 Innobase Oy
 
5
 
23
6
Created July 12, 2007 Vasil Dimov
24
7
*******************************************************/
25
8
 
39
22
#include "trx0types.h"
40
23
#include "ut0lst.h"
41
24
 
42
 
/** A table lock */
 
25
/* A table lock */
43
26
typedef struct lock_table_struct        lock_table_t;
44
 
/** A table lock */
45
27
struct lock_table_struct {
46
 
        dict_table_t*   table;          /*!< database table in dictionary
 
28
        dict_table_t*   table;          /* database table in dictionary
47
29
                                        cache */
48
30
        UT_LIST_NODE_T(lock_t)
49
 
                        locks;          /*!< list of locks on the same
 
31
                        locks;          /* list of locks on the same
50
32
                                        table */
51
33
};
52
34
 
53
 
/** Record lock for a page */
 
35
/* Record lock for a page */
54
36
typedef struct lock_rec_struct          lock_rec_t;
55
 
/** Record lock for a page */
56
37
struct lock_rec_struct {
57
 
        ulint   space;                  /*!< space id */
58
 
        ulint   page_no;                /*!< page number */
59
 
        ulint   n_bits;                 /*!< number of bits in the lock
 
38
        ulint   space;                  /* space id */
 
39
        ulint   page_no;                /* page number */
 
40
        ulint   n_bits;                 /* number of bits in the lock
60
41
                                        bitmap; NOTE: the lock bitmap is
61
42
                                        placed immediately after the
62
43
                                        lock struct */
63
44
};
64
45
 
65
 
/** Lock struct */
 
46
/* Lock struct */
66
47
struct lock_struct {
67
 
        trx_t*          trx;            /*!< transaction owning the
 
48
        trx_t*          trx;            /* transaction owning the
68
49
                                        lock */
69
50
        UT_LIST_NODE_T(lock_t)
70
 
                        trx_locks;      /*!< list of the locks of the
 
51
                        trx_locks;      /* list of the locks of the
71
52
                                        transaction */
72
 
        ulint           type_mode;      /*!< lock type, mode, LOCK_GAP or
 
53
        ulint           type_mode;      /* lock type, mode, LOCK_GAP or
73
54
                                        LOCK_REC_NOT_GAP,
74
55
                                        LOCK_INSERT_INTENTION,
75
56
                                        wait flag, ORed */
76
 
        hash_node_t     hash;           /*!< hash chain node for a record
 
57
        hash_node_t     hash;           /* hash chain node for a record
77
58
                                        lock */
78
 
        dict_index_t*   index;          /*!< index for a record lock */
 
59
        dict_index_t*   index;          /* index for a record lock */
79
60
        union {
80
 
                lock_table_t    tab_lock;/*!< table lock */
81
 
                lock_rec_t      rec_lock;/*!< record lock */
82
 
        } un_member;                    /*!< lock details */
 
61
                lock_table_t    tab_lock;/* table lock */
 
62
                lock_rec_t      rec_lock;/* record lock */
 
63
        } un_member;
83
64
};
84
65
 
85
 
/*********************************************************************//**
86
 
Gets the type of a lock.
87
 
@return LOCK_TABLE or LOCK_REC */
 
66
/*************************************************************************
 
67
Gets the type of a lock. */
88
68
UNIV_INLINE
89
69
ulint
90
70
lock_get_type_low(
91
71
/*==============*/
92
 
        const lock_t*   lock);  /*!< in: lock */
93
 
 
94
 
/*********************************************************************//**
95
 
Gets the previous record lock set on a record.
96
 
@return previous lock on the same record, NULL if none exists */
97
 
UNIV_INTERN
 
72
                                /* out: LOCK_TABLE or LOCK_REC */
 
73
        const lock_t*   lock);  /* in: lock */
 
74
 
 
75
/*************************************************************************
 
76
Gets the previous record lock set on a record. */
 
77
 
98
78
const lock_t*
99
79
lock_rec_get_prev(
100
80
/*==============*/
101
 
        const lock_t*   in_lock,/*!< in: record lock */
102
 
        ulint           heap_no);/*!< in: heap number of the record */
 
81
                                /* out: previous lock on the same
 
82
                                record, NULL if none exists */
 
83
        const lock_t*   in_lock,/* in: record lock */
 
84
        ulint           heap_no);/* in: heap number of the record */
103
85
 
104
86
#ifndef UNIV_NONINL
105
87
#include "lock0priv.ic"