Drizzled Public API Documentation

cache.h
1 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3  *
4  * Copyright (C) 2009 Sun Microsystems, Inc.
5  *
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; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #pragma once
21 
22 #include <boost/thread/condition_variable.hpp>
23 #include <boost/thread/mutex.hpp>
24 #include <drizzled/visibility.h>
25 #include <drizzled/common_fwd.h>
26 #include <list>
27 
28 namespace drizzled {
29 namespace session {
30 
32 {
33  typedef boost::shared_ptr<drizzled::Session> session_ptr;
34 public:
35  typedef std::list<session_ptr> list;
36 
37  static list &getCache()
38  {
39  return cache;
40  }
41 
42  static boost::mutex &mutex()
43  {
44  return _mutex;
45  }
46 
47  static boost::condition_variable &cond()
48  {
49  return _end;
50  }
51 
52  static void shutdownFirst();
53  static void shutdownSecond();
54 
55  static void erase(const session_ptr&);
56  static size_t count();
57  static void insert(const session_ptr&);
58 
59  static session_ptr find(const session_id_t&);
60 
61 private:
62  static bool volatile _ready_to_exit;
63  static list cache;
64  static boost::mutex _mutex;
65  static boost::condition_variable _end;
66 };
67 
68 } /* namespace session */
69 } /* namespace drizzled */
70 
TODO: Rename this file - func.h is stupid.
#define DRIZZLED_API
Definition: visibility.h:62
Visibility Control Macros.