]> granicus.if.org Git - gc/commitdiff
Fix USE_CUSTOM_SPECIFIC mode (if manually enabled) for Win32
authorIvan Maidanski <ivmai@mail.ru>
Sat, 21 Apr 2012 16:18:55 +0000 (20:18 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Sat, 21 Apr 2012 16:18:55 +0000 (20:18 +0400)
* 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

index bf682d132bd651cbb436c20d71cd5fe1eda69a74..bf2bc6442e383a6ca1f8811a31835dccfd377404 100644 (file)
@@ -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();
   }