~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/lock.h

  • Committer: Lee Bieber
  • Date: 2010-11-14 23:15:42 UTC
  • mfrom: (1929.1.42 warning-stack-frame)
  • Revision ID: kalebral@gmail.com-20101114231542-fnnu6ydd2p17n582
Merge Monty - fix bug 672372: some functions use > 32k stack

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
33
33
 
34
34
class DrizzleLock
35
35
{
 
36
  std::vector<Table *> table;
 
37
  std::vector<THR_LOCK_DATA *> locks;
36
38
public:
 
39
  uint32_t table_count;
 
40
  uint32_t lock_count;
 
41
 
37
42
  Table **getTable()
38
43
  {
39
44
    return &table[0];
44
49
    return &locks[0];
45
50
  }
46
51
 
47
 
  size_t sizeTable() const
48
 
  {
49
 
    return table.size();
50
 
  }
51
 
 
52
 
  void resizeTable(size_t arg)
53
 
  {
54
 
    table.resize(arg);
55
 
  }
56
 
 
57
 
  size_t sizeLock() const
 
52
  size_t sizeLock()
58
53
  {
59
54
    return lock_count;
60
55
  }
61
56
 
 
57
  size_t sizeTable()
 
58
  {
 
59
    return table_count;
 
60
  }
 
61
 
62
62
  void resetLock()
63
63
  {
64
64
    lock_count= 0;
69
69
    lock_count= arg;
70
70
  }
71
71
 
 
72
  void setTable(size_t arg)
 
73
  {
 
74
    table_count= arg;
 
75
  }
 
76
 
72
77
  void reset(void);
73
78
  void unlock(uint32_t count);
74
79
 
75
 
  DrizzleLock(size_t table_count_arg)
 
80
  DrizzleLock(size_t table_count_arg, size_t lock_count_arg) :
 
81
    table_count(table_count_arg),
 
82
    lock_count(lock_count_arg)
76
83
  {
77
 
    table.resize(table_count_arg);
78
 
    lock_count= table_count_arg * 2;
 
84
    table.resize(table_count);
79
85
    locks.resize(lock_count);
80
86
  }
81
87
 
82
 
private:
83
 
  uint32_t lock_count;
84
 
 
85
 
  std::vector<Table *> table;
86
 
  std::vector<THR_LOCK_DATA *> locks;
87
 
  std::vector<THR_LOCK_DATA *> copy_of;
88
88
};
89
89
 
90
90
/* lockTables() and open_table() flags bits */