1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
* Copyright (C) 2008 Sun Microsystems
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DRIZZLED_LOCK_H
#define DRIZZLED_LOCK_H
#include <vector>
#include "drizzled/thr_lock.h"
#include "drizzled/locking/global.h"
namespace drizzled
{
class Session;
class Table;
class TableList;
class DrizzleLock
{
std::vector<Table *> table;
std::vector<THR_LOCK_DATA *> locks;
public:
uint32_t table_count;
uint32_t lock_count;
Table **getTable()
{
return &table[0];
}
THR_LOCK_DATA **getLocks()
{
return &locks[0];
}
size_t sizeLock()
{
return lock_count;
}
size_t sizeTable()
{
return table_count;
}
void resetLock()
{
lock_count= 0;
}
void setLock(size_t arg)
{
lock_count= arg;
}
void setTable(size_t arg)
{
table_count= arg;
}
void reset(void);
void unlock(uint32_t count);
DrizzleLock(size_t table_count_arg, size_t lock_count_arg) :
table_count(table_count_arg),
lock_count(lock_count_arg)
{
table.resize(table_count);
locks.resize(lock_count);
}
};
/* lockTables() and open_table() flags bits */
#define DRIZZLE_LOCK_IGNORE_GLOBAL_READ_LOCK 0x0001
#define DRIZZLE_LOCK_IGNORE_FLUSH 0x0002
#define DRIZZLE_LOCK_NOTIFY_IF_NEED_REOPEN 0x0004
#define DRIZZLE_OPEN_TEMPORARY_ONLY 0x0008
} /* namespace drizzled */
#endif /* DRIZZLED_LOCK_H */
|