summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorNicolas Noble <pixel@nobis-crew.org>2013-08-01 19:10:39 -0700
committerNicolas Noble <pixel@nobis-crew.org>2013-08-01 19:10:39 -0700
commit7f4f068ebdfd51c358648e514660b23d586d4929 (patch)
tree0b3509369a98db35fcca56d0b27feada2a7f8d5b /includes
parent20b8ddc82b3c7b725993b2053acb35676801ce8b (diff)
When creating a new Task, steal the TLS values from its creator.
Diffstat (limited to 'includes')
-rw-r--r--includes/Local.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/includes/Local.h b/includes/Local.h
index d009de7..f1174c4 100644
--- a/includes/Local.h
+++ b/includes/Local.h
@@ -28,7 +28,12 @@ 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; }
+ static void * createTLS(void * c = NULL) {
+ void * r = calloc(s_size * sizeof(void *), 1);
+ if (c)
+ memcpy(r, c, s_size * sizeof(void *));
+ return r;
+ }
protected:
Local() : AtStart(0) { }
void * getGlobal() { return m_globals[m_idx]; }