From f2296deb57cdda01685f0d0ccf3c6e200378c673 Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Fri, 30 Mar 2012 12:36:52 -0700 Subject: [PATCH] Clean up tsd (no functional changes). --- include/jemalloc/internal/tcache.h | 4 +++- include/jemalloc/internal/tsd.h | 14 ++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/include/jemalloc/internal/tcache.h b/include/jemalloc/internal/tcache.h index 12552d81..efae7003 100644 --- a/include/jemalloc/internal/tcache.h +++ b/include/jemalloc/internal/tcache.h @@ -227,7 +227,9 @@ tcache_get(bool create) * tcache_create() failure is a soft failure * that doesn't propagate. However, if TLS * data are freed via free() as in glibc, - * subtle TLS corruption could result. + * subtle corruption could result from setting + * a TLS variable after its backing memory is + * freed. */ return (NULL); } diff --git a/include/jemalloc/internal/tsd.h b/include/jemalloc/internal/tsd.h index 0e32c612..60aaa427 100644 --- a/include/jemalloc/internal/tsd.h +++ b/include/jemalloc/internal/tsd.h @@ -109,13 +109,8 @@ a_attr bool a_name##_booted = false; #define malloc_tsd_funcs(a_attr, a_name, a_type, a_initializer, \ a_cleanup) \ /* Initialization/cleanup. */ \ -a_attr void \ +a_attr bool \ a_name##_tsd_cleanup_wrapper(void *arg) \ -{ \ - \ -} \ -bool \ -a_name##_tsd_cleanup_pending(void *arg) \ { \ bool (*cleanup)(void *) = arg; \ \ @@ -131,7 +126,7 @@ a_name##_tsd_boot(void) \ \ if (a_cleanup != malloc_tsd_no_cleanup) { \ malloc_tsd_cleanup_register( \ - &a_name##_tsd_cleanup_pending, a_cleanup); \ + &a_name##_tsd_cleanup_wrapper, a_cleanup); \ } \ a_name##_booted = true; \ return (false); \ @@ -157,11 +152,6 @@ a_name##_tsd_set(a_type *val) \ #define malloc_tsd_funcs(a_attr, a_name, a_type, a_initializer, \ a_cleanup) \ /* Initialization/cleanup. */ \ -a_attr void \ -a_name##_tsd_cleanup_wrapper(void *arg) \ -{ \ - \ -} \ a_attr bool \ a_name##_tsd_boot(void) \ { \