summaryrefslogtreecommitdiff
path: root/includes/Local.h
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2012-09-01 10:04:05 -0700
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2012-09-01 10:27:52 -0700
commit4a893f72cadaa875a920db8949171b002f656e43 (patch)
tree1e08a3cb6f579cab9c3c9a138d36ababdf76121b /includes/Local.h
parent56d91ddd2cd42b782cde0bb3fdf4eb9ebe7597be (diff)
parent06674e57649d536cf19715524ee40c5ad4a9026d (diff)
Merge commit '06674e57649d536cf19715524ee40c5ad4a9026d'
Conflicts: includes/LuaTask.h includes/TaskMan.h includes/Threads.h src/TaskMan.cc src/Threads.cc
Diffstat (limited to 'includes/Local.h')
-rw-r--r--includes/Local.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/includes/Local.h b/includes/Local.h
index 6a598ab..9221384 100644
--- a/includes/Local.h
+++ b/includes/Local.h
@@ -8,7 +8,15 @@ class TLSManager {
public:
virtual void * getTLS();
virtual void * setTLS(void * val);
- void * createTLS();
+};
+
+class PThreadsTLSManager : public TLSManager {
+ public:
+ virtual void * getTLS();
+ virtual void * setTLS(void * val);
+ void init();
+ private:
+ pthread_key_t m_key;
};
extern TLSManager * g_tlsManager;
@@ -16,6 +24,7 @@ extern TLSManager * g_tlsManager;
class Local : public AtStart {
public:
static int getSize() { return s_size; }
+ static void * createTLS() { void * r = calloc(s_size * sizeof(void *), 1); return r; }
protected:
Local() : AtStart(0) { }
void * getGlobal() { return m_globals[m_idx]; }
@@ -26,7 +35,6 @@ class Local : public AtStart {
void set(void * obj) { void * r = getTLS(); if (r) setLocal(obj); else setGlobal(obj); }
int getIndex() { return m_idx; }
private:
- static void * create() { void * r = calloc(s_size * sizeof(void *), 1); return r; }
static void * getTLS() { return g_tlsManager->getTLS(); }
static void * setTLS(void * val) { return g_tlsManager->setTLS(val); }
virtual void doStart();