Fix (allow) thread local allocations from within pthread TLS destructors
authorNiklas Therning <niklas@therning.org>
Tue, 6 Jan 2015 22:32:43 +0000 (23:32 +0100)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 4 Sep 2015 17:36:50 +0000 (20:36 +0300)
commit2c870edc641f6b9e565f7cd297251cfd83de76af
tree740321c4b4718e4f0235c4b7ba47907062470030
parent60db5e97e8c61652f9b29b201832eaadd18f1dfc
Fix (allow) thread local allocations from within pthread TLS destructors

Prevents the GC_thread_key from being cleared on thread exit until
after the thread has been unregistered by GC_unregister_my_thread_inner.

* include/private/thread_local_alloc.h (GC_remove_specific): Call
pthread_setspecific(key, NULL) if USE_PTHREAD_SPECIFIC; update comment.
* thread_local_alloc.c (reset_thread_key): New static function if
USE_PTHREAD_SPECIFIC); define (as macro) to 0 otherwise.
* thread_local_alloc.c (GC_init_thread_local): Pass reset_thread_key
(instead of 0) to GC_key_create.
include/private/thread_local_alloc.h
thread_local_alloc.c