~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session/cache.h

  • Committer: Olaf van der Spek
  • Date: 2011-07-04 19:11:47 UTC
  • mto: This revision was merged to the branch mainline in revision 2367.
  • Revision ID: olafvdspek@gmail.com-20110704191147-s99ojek811zi1fzj
RemoveĀ unusedĀ Name_resolution_context::error_reporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_SESSION_CACHE_H
21
 
#define DRIZZLED_SESSION_CACHE_H
 
20
#pragma once
22
21
 
 
22
#include <boost/thread/condition_variable.hpp>
 
23
#include <boost/thread/mutex.hpp>
 
24
#include <drizzled/visibility.h>
23
25
#include <list>
24
26
 
25
 
#include <drizzled/visibility.h>
26
 
 
27
 
namespace drizzled
28
 
{
29
 
 
30
 
class Session;
31
 
 
32
 
namespace session
33
 
{
 
27
namespace drizzled {
 
28
namespace session {
34
29
 
35
30
class DRIZZLED_API Cache 
36
31
{
37
 
  typedef boost::shared_ptr<drizzled::Session> session_shared_ptr;
 
32
  typedef boost::shared_ptr<drizzled::Session> session_ptr;
38
33
public:
39
 
  typedef std::list<session_shared_ptr> list;
40
 
 
41
 
  Cache() :
42
 
    _ready_to_exit(false)
43
 
  {
44
 
  }
45
 
 
46
 
  static inline Cache &singleton()
47
 
  {
48
 
    static Cache open_cache;
49
 
 
50
 
    return open_cache;
51
 
  }
52
 
 
53
 
  list &getCache()
 
34
  typedef std::list<session_ptr> list;
 
35
 
 
36
  static list &getCache()
54
37
  {
55
38
    return cache;
56
39
  }
57
40
 
58
 
  boost::mutex &mutex()
 
41
  static boost::mutex &mutex()
59
42
  {
60
43
    return _mutex;
61
44
  }
62
45
 
63
 
  boost::condition_variable &cond()
 
46
  static boost::condition_variable &cond()
64
47
  {
65
48
    return _end;
66
49
  }
67
50
 
68
 
  void shutdownFirst();
69
 
  void shutdownSecond();
70
 
 
71
 
  void erase(session_shared_ptr&);
72
 
  size_t count();
73
 
  void insert(session_shared_ptr &arg);
74
 
 
75
 
  session_shared_ptr find(const session_id_t &id);
 
51
  static void shutdownFirst();
 
52
  static void shutdownSecond();
 
53
 
 
54
  static void erase(const session_ptr&);
 
55
  static size_t count();
 
56
  static void insert(const session_ptr&);
 
57
 
 
58
  static session_ptr find(const session_id_t&);
76
59
 
77
60
private:
78
 
  bool volatile _ready_to_exit;
79
 
  list cache;
80
 
  boost::mutex _mutex;
81
 
  boost::condition_variable _end;
 
61
  static bool volatile _ready_to_exit;
 
62
  static list cache;
 
63
  static boost::mutex _mutex;
 
64
  static boost::condition_variable _end;
82
65
};
83
66
 
84
67
} /* namespace session */
85
68
} /* namespace drizzled */
86
69
 
87
 
#endif /* DRIZZLED_SESSION_CACHE_H */