From 7f4f068ebdfd51c358648e514660b23d586d4929 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Thu, 1 Aug 2013 19:10:39 -0700 Subject: When creating a new Task, steal the TLS values from its creator. --- includes/Local.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'includes') 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]; } -- cgit v1.2.3