~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/lock.h

  • Committer: Barry.Leslie at PrimeBase
  • Date: 2010-10-20 20:41:00 UTC
  • mfrom: (1863 staging)
  • mto: This revision was merged to the branch mainline in revision 1871.
  • Revision ID: barry.leslie@primebase.com-20101020204100-oyj6p5cfssjw3p62
Merged with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#ifndef DRIZZLED_LOCK_H
21
21
#define DRIZZLED_LOCK_H
22
22
 
 
23
#include <vector>
23
24
#include "drizzled/thr_lock.h"
24
25
 
25
26
namespace drizzled
28
29
class Session;
29
30
class Table;
30
31
class TableList;
31
 
class DrizzleLock;
 
32
 
 
33
class DrizzleLock
 
34
{
 
35
  std::vector<Table *> table;
 
36
  std::vector<THR_LOCK_DATA *> locks;
 
37
public:
 
38
  uint32_t table_count;
 
39
  uint32_t lock_count;
 
40
 
 
41
  Table **getTable()
 
42
  {
 
43
    return &table[0];
 
44
  }
 
45
 
 
46
  THR_LOCK_DATA **getLocks()
 
47
  {
 
48
    return &locks[0];
 
49
  }
 
50
 
 
51
  size_t sizeLock()
 
52
  {
 
53
    return lock_count;
 
54
  }
 
55
 
 
56
  size_t sizeTable()
 
57
  {
 
58
    return table_count;
 
59
  }
 
60
 
 
61
  void resetLock()
 
62
  {
 
63
    lock_count= 0;
 
64
  }
 
65
 
 
66
  void setLock(size_t arg)
 
67
  {
 
68
    lock_count= arg;
 
69
  }
 
70
 
 
71
  void setTable(size_t arg)
 
72
  {
 
73
    table_count= arg;
 
74
  }
 
75
 
 
76
  void reset(void);
 
77
  void unlock(uint32_t count);
 
78
 
 
79
  DrizzleLock(size_t table_count_arg, size_t lock_count_arg) :
 
80
    table_count(table_count_arg),
 
81
    lock_count(lock_count_arg)
 
82
  {
 
83
    table.resize(table_count);
 
84
    locks.resize(lock_count);
 
85
  }
 
86
 
 
87
};
32
88
 
33
89
DrizzleLock *mysql_lock_tables(Session *session, Table **table, uint32_t count,
34
90
                               uint32_t flags, bool *need_reopen);