[ 23753]
Turn INIT_TLS_AND_INTERP into a static function
[ 23755]
Foolishly I committed change 23753 before remembering to test without
ithreads. No tests => bugs. This should fix them.
[ 30119]
Change 23753 wasn't quite a perfect refactoring, as it omitted calling
PERL_SET_THX(my_perl); when !PL_curinterp for non-ithreads.
However, this would not have made a difference for any configuration
buildable from the blead source alone.
p4raw-link: @30119 on //depot/perl:
c0bce9aa45a3d3e9c7a6fd9886d453d0ab22e69d
p4raw-link: @23755 on //depot/perl:
daa7d858611c04f05c8f8e9aadf2e84dafe7e1e8
p4raw-link: @23753 on //depot/perl:
e6827a76d6739cf7ead59ff0f2fbe7afeb7086ed
p4raw-id: //depot/maint-5.8/perl@30121
p4raw-integrated: from //depot/perl@30118 'edit in' perl.c (@30105..)
+static void
+S_init_tls_and_interp(PerlInterpreter *my_perl)
+{
+ if (!PL_curinterp) {
+ PERL_SET_INTERP(my_perl);
#if defined(USE_5005THREADS)
#if defined(USE_5005THREADS)
-# define INIT_TLS_AND_INTERP \
- STMT_START { \
- if (!PL_curinterp) { \
- PERL_SET_INTERP(my_perl); \
- INIT_THREADS; \
- ALLOC_THREAD_KEY; \
- } \
- } STMT_END
+ INIT_THREADS;
+ ALLOC_THREAD_KEY;
#else
# if defined(USE_ITHREADS)
#else
# if defined(USE_ITHREADS)
-# define INIT_TLS_AND_INTERP \
- STMT_START { \
- if (!PL_curinterp) { \
- PERL_SET_INTERP(my_perl); \
- INIT_THREADS; \
- ALLOC_THREAD_KEY; \
- PERL_SET_THX(my_perl); \
- OP_REFCNT_INIT; \
- MUTEX_INIT(&PL_dollarzero_mutex); \
- } \
- else { \
- PERL_SET_THX(my_perl); \
- } \
- } STMT_END
-# else
-# define INIT_TLS_AND_INTERP \
- STMT_START { \
- if (!PL_curinterp) { \
- PERL_SET_INTERP(my_perl); \
- } \
- PERL_SET_THX(my_perl); \
- } STMT_END
+ INIT_THREADS;
+ ALLOC_THREAD_KEY;
+ PERL_SET_THX(my_perl);
+ OP_REFCNT_INIT;
+ MUTEX_INIT(&PL_dollarzero_mutex);
+ }
+#if defined(USE_ITHREADS)
+ else
+#else
+ /* This always happens for non-ithreads */
+#endif
+ {
+ PERL_SET_THX(my_perl);
#ifdef PERL_IMPLICIT_SYS
PerlInterpreter *
#ifdef PERL_IMPLICIT_SYS
PerlInterpreter *
PerlInterpreter *my_perl;
/* Newx() needs interpreter, so call malloc() instead */
my_perl = (PerlInterpreter*)(*ipM->pMalloc)(ipM, sizeof(PerlInterpreter));
PerlInterpreter *my_perl;
/* Newx() needs interpreter, so call malloc() instead */
my_perl = (PerlInterpreter*)(*ipM->pMalloc)(ipM, sizeof(PerlInterpreter));
+ S_init_tls_and_interp(my_perl);
Zero(my_perl, 1, PerlInterpreter);
PL_Mem = ipM;
PL_MemShared = ipMS;
Zero(my_perl, 1, PerlInterpreter);
PL_Mem = ipM;
PL_MemShared = ipMS;
/* Newx() needs interpreter, so call malloc() instead */
my_perl = (PerlInterpreter*)PerlMem_malloc(sizeof(PerlInterpreter));
/* Newx() needs interpreter, so call malloc() instead */
my_perl = (PerlInterpreter*)PerlMem_malloc(sizeof(PerlInterpreter));
+ S_init_tls_and_interp(my_perl);
#ifndef PERL_TRACK_MEMPOOL
return (PerlInterpreter *) ZeroD(my_perl, 1, PerlInterpreter);
#else
#ifndef PERL_TRACK_MEMPOOL
return (PerlInterpreter *) ZeroD(my_perl, 1, PerlInterpreter);
#else