~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session_list.h

  • Committer: lbieber at stabletransit
  • Date: 2010-10-19 14:03:27 UTC
  • mfrom: (1861.1.2 build)
  • Revision ID: lbieber@drizzle-build-n02.wc1.dfw1.stabletransit.com-20101019140327-2jvt5j2wi4pzhm1z
Merge Brian - Small collection of cleanups/refactor'ing around locks
Merge Monty - fix a few things in the tarball

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, Inc.
 
4
 *  Copyright (C) 2009 Sun Microsystems
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_CACHE_H
21
 
#define DRIZZLED_SESSION_CACHE_H
 
20
#ifndef DRIZZLED_SESSION_LIST_H
 
21
#define DRIZZLED_SESSION_LIST_H
22
22
 
23
23
#include <list>
24
24
 
25
 
#include <drizzled/visibility.h>
26
 
 
27
25
namespace drizzled
28
26
{
29
27
 
30
28
class Session;
31
 
 
32
 
namespace session
33
 
{
34
 
 
35
 
class DRIZZLED_API Cache 
36
 
{
37
 
  typedef boost::shared_ptr<drizzled::Session> session_shared_ptr;
38
 
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()
54
 
  {
55
 
    return cache;
56
 
  }
57
 
 
58
 
  boost::mutex &mutex()
59
 
  {
60
 
    return _mutex;
61
 
  }
62
 
 
63
 
  boost::condition_variable &cond()
64
 
  {
65
 
    return _end;
66
 
  }
67
 
 
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);
76
 
 
77
 
private:
78
 
  bool volatile _ready_to_exit;
79
 
  list cache;
80
 
  boost::mutex _mutex;
81
 
  boost::condition_variable _end;
82
 
};
83
 
 
84
 
} /* namespace session */
85
 
} /* namespace drizzled */
86
 
 
87
 
#endif /* DRIZZLED_SESSION_CACHE_H */
 
29
typedef Session* SessionPtr;
 
30
typedef std::list<SessionPtr> SessionList;
 
31
SessionList &getSessionList();
 
32
 
 
33
}
 
34
 
 
35
#endif /* DRIZZLED_SESSION_LIST_H */