~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/lock.h

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

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
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
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;
38
36
public:
39
 
  uint32_t table_count;
40
 
  uint32_t lock_count;
41
 
 
42
37
  Table **getTable()
43
38
  {
44
39
    return &table[0];
49
44
    return &locks[0];
50
45
  }
51
46
 
52
 
  size_t sizeLock()
 
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
53
58
  {
54
59
    return lock_count;
55
60
  }
56
61
 
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
 
 
77
72
  void reset(void);
78
73
  void unlock(uint32_t count);
79
74
 
80
 
  DrizzleLock(size_t table_count_arg, size_t lock_count_arg) :
81
 
    table_count(table_count_arg),
82
 
    lock_count(lock_count_arg)
 
75
  DrizzleLock(size_t table_count_arg)
83
76
  {
84
 
    table.resize(table_count);
 
77
    table.resize(table_count_arg);
 
78
    lock_count= table_count_arg * 2;
85
79
    locks.resize(lock_count);
86
80
  }
87
81
 
 
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 */