diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2017-06-23 14:06:11 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2017-06-23 14:24:31 +0300 |
commit | 360407b2586eb6a612cff3863f0286b133bdc197 (patch) | |
tree | fbc4dd389cbf88159ca5c0ee8d88f0da868cef7f /thread_local_alloc.c | |
parent | 3b16a75d1db40a052123b0cdce7d4bb17a5e32d6 (diff) | |
download | bdwgc-360407b2586eb6a612cff3863f0286b133bdc197.tar.gz |
Make GC_INIT optional for clients even if thread-local allocations enabled
* tests/test.c (GC_OPT_INIT): Do not define to GC_INIT() even if
THREAD_LOCAL_ALLOC; force define to GC_INIT() if TEST_EXPLICIT_GC_INIT
macro defined.
* thread_local_alloc.c [USE_PTHREAD_SPECIFIC || USE_WIN32_SPECIFIC]
(GC_malloc_kind): Check keys_initialized before GC_getspecific call
(fall back to GC_malloc_kind_global if keys_initialized is false).
Diffstat (limited to 'thread_local_alloc.c')
-rw-r--r-- | thread_local_alloc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/thread_local_alloc.c b/thread_local_alloc.c index 0919935d..aacd855e 100644 --- a/thread_local_alloc.c +++ b/thread_local_alloc.c @@ -170,6 +170,8 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_kind(size_t bytes, int knd) tsd = GC_getspecific(k); } # else + if (!EXPECT(keys_initialized, TRUE)) + return GC_malloc_kind_global(bytes, knd); tsd = GC_getspecific(GC_thread_key); # endif # if !defined(USE_COMPILER_TLS) && !defined(USE_WIN32_COMPILER_TLS) |