From 4afe5d90d85d8f7a156891d24da42b585ae7eaec Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 15 Nov 2011 14:44:29 +0400 Subject: [PATCH] Fix thread_local_alloc GC_malloc[_atomic] for USE_CUSTOM_SPECIFIC TLS platforms (e.g., Solaris) * thread_local_alloc.c (GC_malloc, GC_malloc_atomic): Test result of GC_getspecific() for NULL in all cases except for USE_COMPILER_TLS and USE_WIN32_COMPILER_TLS (i.e., no-op implementation of GC_getspecific). --- thread_local_alloc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/thread_local_alloc.c b/thread_local_alloc.c index 37b5579e..e208f8b1 100644 --- a/thread_local_alloc.c +++ b/thread_local_alloc.c @@ -163,6 +163,8 @@ GC_API void * GC_CALL GC_malloc(size_t bytes) tsd = GC_getspecific(k); # else tsd = GC_getspecific(GC_thread_key); +# endif +# if !defined(USE_COMPILER_TLS) && !defined(USE_WIN32_COMPILER_TLS) if (EXPECT(0 == tsd, FALSE)) { return GC_core_malloc(bytes); } @@ -198,6 +200,8 @@ GC_API void * GC_CALL GC_malloc_atomic(size_t bytes) tsd = GC_getspecific(k); # else tsd = GC_getspecific(GC_thread_key); +# endif +# if !defined(USE_COMPILER_TLS) && !defined(USE_WIN32_COMPILER_TLS) if (EXPECT(0 == tsd, FALSE)) { return GC_core_malloc_atomic(bytes); } -- 2.40.0