~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session/cache.cc

  • Committer: Brian Aker
  • Date: 2010-12-01 21:54:28 UTC
  • mto: This revision was merged to the branch mainline in revision 1968.
  • Revision ID: brian@tangent.org-20101201215428-wzfiji3cj386lrmp
Merge in change to push session list in to its own directory above first
level.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
#include <vector>
23
23
 
24
 
#include "drizzled/session_list.h"
 
24
#include "drizzled/session/cache.h"
25
25
#include "drizzled/session.h"
26
26
#include "drizzled/current_session.h"
27
27
#include "drizzled/plugin/authorization.h"
28
28
 
29
 
using namespace std;
 
29
#include <boost/foreach.hpp>
30
30
 
31
31
namespace drizzled
32
32
{
37
37
Session::shared_ptr Cache::find(const session_id_t &id)
38
38
{
39
39
  boost::mutex::scoped_lock scopedLock(_mutex);
40
 
  for (List::iterator it= cache.begin(); it != cache.end(); ++it )
 
40
 
 
41
  BOOST_FOREACH(list::const_reference it, cache)
41
42
  {
42
 
    if ((*it)->thread_id == id)
 
43
    if (it->thread_id == id)
43
44
    {
44
 
      return *it;
 
45
      return it;
45
46
    }
46
47
  }
47
48
 
57
58
 
58
59
void Cache::erase(Session::Ptr arg)
59
60
{
60
 
  for (List::iterator it= cache.begin(); it != cache.end(); it++)
 
61
  BOOST_FOREACH(list::const_reference it, cache)
61
62
  {
62
 
    if ((*it).get() == arg)
 
63
    if (it.get() == arg)
63
64
    {
64
 
      cache.erase(it);
 
65
      cache.remove(it);
65
66
      return;
66
67
    }
67
68
  }