This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [PATCH] [ID 20000820.012] Not OK: perl v5.7.0 +SUIDMAIL +DEVEL6735 on
[perl5.git] / thread.h
index f7ab18c..9740dba 100644 (file)
--- a/thread.h
+++ b/thread.h
 #define INIT_THREADS           cthread_init()
 #define YIELD                  cthread_yield()
 #define ALLOC_THREAD_KEY       NOOP
+#define FREE_THREAD_KEY                NOOP
 #define SET_THREAD_SELF(thr)   (thr->self = cthread_self())
 
 #endif /* I_MACH_CTHREADS */
 #  define ALLOC_THREAD_KEY \
     STMT_START {                                               \
        if (pthread_key_create(&PL_thr_key, 0)) {               \
-           fprintf(stderr, "panic: pthread_key_create");       \
+           PerlIO_printf(PerlIO_stderr(), "panic: pthread_key_create");        \
            exit(1);                                            \
        }                                                       \
     } STMT_END
 #endif
 
+#ifndef FREE_THREAD_KEY
+#  define FREE_THREAD_KEY \
+    STMT_START {                                               \
+       pthread_key_delete(PL_thr_key);                         \
+    } STMT_END
+#endif
+
 #ifndef THREAD_RET_TYPE
 #  define THREAD_RET_TYPE      void *
 #  define THREAD_RET_CAST(p)   ((void *)(p))