~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/generator/session.h

  • Committer: Brian Aker
  • Date: 2010-11-08 18:24:58 UTC
  • mto: (1921.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 1916.
  • Revision ID: brian@tangent.org-20101108182458-twv4hyix43ojno80
Merge in changes such that lock is now broken out into its own directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef DRIZZLED_GENERATOR_SESSION_H
22
22
#define DRIZZLED_GENERATOR_SESSION_H
23
23
 
24
 
#include <boost/thread/mutex.hpp>
25
 
#include "drizzled/session/cache.h"
 
24
#include "drizzled/pthread_globals.h"
 
25
#include "drizzled/session_list.h"
26
26
 
27
27
namespace drizzled {
28
28
namespace generator {
29
29
 
30
30
class Session
31
31
{
32
 
  session::Cache::list local_list;
33
 
  session::Cache::list::const_iterator iter;
 
32
  SessionList local_list;
 
33
  SessionList::const_iterator iter;
34
34
 
35
35
public:
36
36
 
37
37
  Session()
38
38
  {
39
 
    boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
40
 
    local_list= session::Cache::singleton().getCache();
 
39
    LOCK_thread_count.lock();
 
40
    local_list= getSessionList();
41
41
    iter= local_list.begin();
42
42
  }
43
43
 
44
44
  ~Session()
45
45
  {
 
46
    LOCK_thread_count.unlock();
46
47
  }
47
48
 
48
 
  operator drizzled::Session::shared_ptr()
 
49
  operator drizzled::SessionPtr()
49
50
  {
50
51
    while (iter != local_list.end())
51
52
    {
55
56
        continue;
56
57
      }
57
58
 
58
 
      drizzled::Session::shared_ptr ret(*iter);
 
59
      drizzled::SessionPtr ret= *iter;
59
60
      iter++;
60
61
      return ret;
61
62
    }
62
63
 
63
 
    return drizzled::Session::shared_ptr();
 
64
    return NULL;
64
65
  }
65
66
};
66
67