Allocing a TLS in runtime is not too hot.
Artur Bergman [Fri, 26 Oct 2001 12:06:30 +0000 (12:06 +0000)]
p4raw-id: //depot/perl@12675

ext/threads/threads.xs

index 6d8394f..56c046d 100755 (executable)
@@ -23,7 +23,6 @@ void* Perl_thread_run(void * arg) {
 
        SHAREDSvLOCK(threads);
        SHAREDSvEDIT(threads);
-       PERL_THREAD_ALLOC_SPECIFIC(self_key);
        PERL_THREAD_SETSPECIFIC(self_key,INT2PTR(void*,thread->tid));
        thread_tid_ptr = Perl_newSVuv(PL_sharedsv_space, thread->tid);  
        thread_ptr = Perl_newSVuv(PL_sharedsv_space, PTR2UV(thread));
@@ -279,6 +278,7 @@ void Perl_thread_destruct (ithread* thread) {
 MODULE = threads               PACKAGE = threads               
 BOOT:
        Perl_sharedsv_init(aTHX);
+       PERL_THREAD_ALLOC_SPECIFIC(self_key);
        PL_perl_destruct_level = 2;
        threads = Perl_sharedsv_new(aTHX);
        SHAREDSvEDIT(threads);