~drizzle-trunk/drizzle/development

« back to all changes in this revision

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