~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-02-12 18:24:24 UTC
  • mto: (2167.1.2 build) (2172.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 2168.
  • Revision ID: olafvdspek@gmail.com-20110212182424-kgnm9osi7qo97at2
casts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
20
20
#include "config.h"
21
21
#include <drizzled/current_session.h>
22
22
 
23
 
#include <pthread.h>
24
 
 
25
23
namespace drizzled
26
24
{
27
25
 
28
 
extern pthread_key_t THR_Session;
29
 
extern pthread_key_t THR_Mem_root;
 
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
}
30
38
 
31
39
Session *_current_session(void)
32
40
{
33
 
  return static_cast<Session *>(pthread_getspecific(THR_Session));
 
41
  return THR_Session.get();
34
42
}
35
43
 
36
 
 
37
44
memory::Root *current_mem_root(void)
38
45
{
39
 
  return *(static_cast<memory::Root **>(pthread_getspecific(THR_Mem_root)));
 
46
  return *(currentMemRoot().get());
40
47
}
41
48
 
42
49
} /* namespace drizzled */