summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2012-04-18 16:29:48 (GMT)
committerJason Evans <jasone@canonware.com>2012-04-19 02:23:53 (GMT)
commit8ad483fe60a803acdbd403d88bb30b548ee1b5f9 (patch)
tree32711d51f5228787ce9f646d9bad21764680e78b /include
parent7ff1ce4131651fea1df7b1c010d71667bc574816 (diff)
downloadjemalloc-8ad483fe60a803acdbd403d88bb30b548ee1b5f9.zip
jemalloc-8ad483fe60a803acdbd403d88bb30b548ee1b5f9.tar.gz
jemalloc-8ad483fe60a803acdbd403d88bb30b548ee1b5f9.tar.bz2
Remove initialization of the non-TLS tsd wrapper from static memory
Using static memory when malloc_tsd_malloc fails means all threads share the same wrapper and thus the same wrapped value. This defeats the purpose of TSD.
Diffstat (limited to 'include')
-rw-r--r--include/jemalloc/internal/tsd.h15
1 files changed, 3 insertions, 12 deletions
diff --git a/include/jemalloc/internal/tsd.h b/include/jemalloc/internal/tsd.h
index 3f953f9..5888b37 100644
--- a/include/jemalloc/internal/tsd.h
+++ b/include/jemalloc/internal/tsd.h
@@ -192,7 +192,6 @@ a_name##_tsd_set(a_type *val) \
a_cleanup) \
/* Data structure. */ \
typedef struct { \
- bool isstatic; \
bool initialized; \
a_type val; \
} a_name##_tsd_wrapper_t; \
@@ -218,8 +217,7 @@ a_name##_tsd_cleanup_wrapper(void *arg) \
return; \
} \
} \
- if (wrapper->isstatic == false) \
- malloc_tsd_dalloc(wrapper); \
+ malloc_tsd_dalloc(wrapper); \
} \
a_attr bool \
a_name##_tsd_boot(void) \
@@ -242,17 +240,11 @@ a_name##_tsd_get_wrapper(void) \
wrapper = (a_name##_tsd_wrapper_t *) \
malloc_tsd_malloc(sizeof(a_name##_tsd_wrapper_t)); \
if (wrapper == NULL) { \
- static a_name##_tsd_wrapper_t \
- a_name##_tsd_static_data = \
- {true, false, a_initializer}; \
malloc_write("<jemalloc>: Error allocating" \
" TSD for "#a_name"\n"); \
- if (opt_abort) \
- abort(); \
- wrapper = &a_name##_tsd_static_data; \
+ abort(); \
} else { \
static a_type tsd_static_data = a_initializer; \
- wrapper->isstatic = false; \
wrapper->initialized = false; \
wrapper->val = tsd_static_data; \
} \
@@ -260,8 +252,7 @@ a_name##_tsd_get_wrapper(void) \
(void *)wrapper)) { \
malloc_write("<jemalloc>: Error setting" \
" TSD for "#a_name"\n"); \
- if (opt_abort) \
- abort(); \
+ abort(); \
} \
} \
return (wrapper); \