~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session/cache.cc

  • Committer: Lee Bieber
  • Date: 2011-01-24 17:20:08 UTC
  • mfrom: (2107.2.1 trunk-bug-703913)
  • mto: This revision was merged to the branch mainline in revision 2109.
  • Revision ID: kalebral@gmail.com-20110124172008-y5maihyoyu7gn18p
Merge Andrew - fix bug 703913: some support-files should be dropped

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
 
#include <config.h>
 
20
#include "config.h"
21
21
 
22
22
#include <vector>
23
23
 
24
 
#include <drizzled/session.h>
25
 
#include <drizzled/session/cache.h>
26
 
#include <drizzled/current_session.h>
27
 
#include <drizzled/plugin/authorization.h>
 
24
#include "drizzled/session/cache.h"
 
25
#include "drizzled/session.h"
 
26
#include "drizzled/current_session.h"
 
27
#include "drizzled/plugin/authorization.h"
28
28
 
29
29
#include <boost/foreach.hpp>
30
30
 
34
34
namespace session
35
35
{
36
36
 
37
 
Cache::session_shared_ptr Cache::find(const session_id_t &id)
 
37
Session::shared_ptr Cache::find(const session_id_t &id)
38
38
{
39
39
  boost::mutex::scoped_lock scopedLock(_mutex);
40
40
 
46
46
    }
47
47
  }
48
48
 
49
 
  return session_shared_ptr();
50
 
}
51
 
 
52
 
void Cache::shutdownFirst()
53
 
{
54
 
  boost::mutex::scoped_lock scopedLock(_mutex);
55
 
  _ready_to_exit= true;
56
 
 
57
 
  /* do the broadcast inside the lock to ensure that my_end() is not called */
58
 
  _end.notify_all();
59
 
}
60
 
 
61
 
  /* Wait until cleanup is done */
62
 
void Cache::shutdownSecond()
63
 
{
64
 
  boost::mutex::scoped_lock scopedLock(_mutex);
65
 
 
66
 
  while (not _ready_to_exit)
67
 
  {
68
 
    _end.wait(scopedLock);
69
 
  }
 
49
  return Session::shared_ptr();
70
50
}
71
51
 
72
52
size_t Cache::count()
76
56
  return cache.size();
77
57
}
78
58
 
79
 
void Cache::insert(session_shared_ptr &arg)
 
59
void Cache::insert(Session::shared_ptr &arg)
80
60
{
81
61
  boost::mutex::scoped_lock scopedLock(_mutex);
82
62
  cache.push_back(arg);
83
63
}
84
64
 
85
 
void Cache::erase(session_shared_ptr &arg)
 
65
void Cache::erase(Session::shared_ptr &arg)
86
66
{
87
67
  list::iterator iter= std::find(cache.begin(), cache.end(), arg);
88
68
  assert(iter != cache.end());