~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session/cache.cc

  • Committer: Olaf van der Spek
  • Date: 2011-06-22 16:36:40 UTC
  • mto: This revision was merged to the branch mainline in revision 2347.
  • Revision ID: olafvdspek@gmail.com-20110622163640-pwub8fpyqfdvqek4
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
boost::mutex Cache::_mutex;
35
35
boost::condition_variable Cache::_end;
36
36
 
37
 
Cache::session_shared_ptr Cache::find(const session_id_t &id)
 
37
Cache::session_ptr Cache::find(const session_id_t &id)
38
38
{
39
39
  boost::mutex::scoped_lock scopedLock(_mutex);
40
40
  BOOST_FOREACH(list::const_reference it, cache)
42
42
    if (it->thread_id == id)
43
43
      return it;
44
44
  }
45
 
  return session_shared_ptr();
 
45
  return session_ptr();
46
46
}
47
47
 
48
48
void Cache::shutdownFirst()
72
72
  return cache.size();
73
73
}
74
74
 
75
 
void Cache::insert(session_shared_ptr &arg)
 
75
void Cache::insert(const session_ptr& arg)
76
76
{
77
77
  boost::mutex::scoped_lock scopedLock(_mutex);
78
78
  cache.push_back(arg);
79
79
}
80
80
 
81
 
void Cache::erase(session_shared_ptr &arg)
 
81
void Cache::erase(const session_ptr& arg)
82
82
{
83
83
  list::iterator iter= std::find(cache.begin(), cache.end(), arg);
84
84
  assert(iter != cache.end());