From 38e65eaaefb295aab3a5fc7c10fd6f89330cf1a4 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sat, 21 Apr 2012 20:18:55 +0400 Subject: [PATCH] Fix USE_CUSTOM_SPECIFIC mode (if manually enabled) for Win32 * win32_threads.c (GC_unregister_my_thread, GC_remove_all_threads_but_me, GC_thread_exit_proc): Invoke GC_remove_specific (if THREAD_LOCAL_ALLOC) after destroying thread-local list (same as in pthread_support.c). --- win32_threads.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/win32_threads.c b/win32_threads.c index bf682d13..bf2bc644 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -831,6 +831,10 @@ GC_API int GC_CALL GC_unregister_my_thread(void) /* else */ { GC_delete_thread(thread_id); } +# if defined(THREAD_LOCAL_ALLOC) + /* It is required to call remove_specific defined in specific.c. */ + GC_remove_specific(GC_thread_key); +# endif UNLOCK(); } return GC_SUCCESS; @@ -1011,6 +1015,7 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, # ifdef THREAD_LOCAL_ALLOC if ((p -> flags & FINISHED) == 0) { GC_destroy_thread_local(&p->tlfs); + GC_remove_specific(GC_thread_key); } # endif if (&first_thread != p) @@ -2659,6 +2664,10 @@ GC_INNER void GC_thr_init(void) /* deallocate it as part of join */ me -> flags |= FINISHED; } +# if defined(THREAD_LOCAL_ALLOC) + /* It is required to call remove_specific defined in specific.c. */ + GC_remove_specific(GC_thread_key); +# endif UNLOCK(); } -- 2.50.1