~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/current_session.cc

  • Committer: Olaf van der Spek
  • Date: 2011-06-21 14:55:36 UTC
  • mto: This revision was merged to the branch mainline in revision 2346.
  • Revision ID: olafvdspek@gmail.com-20110621145536-hd50tbacow514s9s
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include <config.h>
21
21
#include <drizzled/current_session.h>
22
22
 
23
 
namespace drizzled
24
 
{
25
 
 
26
 
static MySessionVar THR_Session;
27
 
static MyMemoryRootVar THR_Mem_root;
28
 
 
29
 
MySessionVar &currentSession(void)
30
 
{
31
 
  return THR_Session;
32
 
}
33
 
 
34
 
MyMemoryRootVar &currentMemRoot(void)
35
 
{
36
 
  return THR_Mem_root;
37
 
}
38
 
 
39
 
Session *_current_session(void)
 
23
namespace drizzled {
 
24
 
 
25
static boost::thread_specific_ptr<Session> THR_Session;
 
26
static boost::thread_specific_ptr<memory::Root> THR_Mem_root;
 
27
 
 
28
Session* _current_session()
40
29
{
41
30
  return THR_Session.get();
42
31
}
43
32
 
44
 
memory::Root *current_mem_root(void)
45
 
{
46
 
  return *(currentMemRoot().get());
 
33
memory::Root* current_mem_root()
 
34
{
 
35
  return THR_Mem_root.get();
 
36
}
 
37
 
 
38
void setCurrentSession(Session* v)
 
39
{
 
40
  if (v)
 
41
    THR_Session.reset(v);
 
42
  else
 
43
    THR_Session.release();
 
44
}
 
45
 
 
46
void setCurrentMemRoot(memory::Root* v)
 
47
{
 
48
  if (v)
 
49
    THR_Mem_root.reset(v);
 
50
  else
 
51
    THR_Mem_root.release();
47
52
}
48
53
 
49
54
} /* namespace drizzled */