1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2010 Brian Aker
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
#include "plugin/user_locks/module.h"
25
#include <drizzled/atomics.h>
26
#include <drizzled/session.h>
28
using namespace drizzled;
31
namespace user_locks {
34
UserBarriers::UserBarriers() :
35
plugin::TableFunction("DATA_DICTIONARY", "USER_DEFINED_BARRIERS")
37
add_field("USER_BARRIER_NAME", plugin::TableFunction::STRING, LARGEST_LOCK_NAME, false);
38
add_field("SESSION_ID", plugin::TableFunction::NUMBER, 0, false);
39
add_field("USER_NAME", plugin::TableFunction::STRING);
40
add_field("WAITER_LIMIT", plugin::TableFunction::NUMBER, 0, false);
41
add_field("GENERATION", plugin::TableFunction::NUMBER, 0, false);
42
add_field("WAITERS", plugin::TableFunction::NUMBER, 0, false);
43
add_field("OBSERVERS", plugin::TableFunction::NUMBER, 0, false);
46
UserBarriers::Generator::Generator(drizzled::Field **arg) :
47
drizzled::plugin::TableFunction::Generator(arg)
49
Barriers::getInstance().Copy(barrier_map);
50
iter= barrier_map.begin();
53
bool UserBarriers::Generator::populate()
56
while (iter != barrier_map.end())
59
push((*iter).first.getLockName());
62
push((*iter).second->getOwner());
65
push((*iter).first.getUser());
68
push((*iter).second->getLimit());
71
push((*iter).second->getGeneration());
74
push((*iter).second->sizeWaiters());
77
push((*iter).second->sizeObservers());
86
} /* namespace barriers */
87
} /* namespace user_locks */