Change 30121 by [EMAIL PROTECTED] on 2007/02/04 21:32:10

        Integrate:
        [ 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.

Affected files ...

... //depot/maint-5.8/perl/perl.c#201 integrate

Differences ...

==== //depot/maint-5.8/perl/perl.c#201 (text) ====
Index: perl/perl.c
--- perl/perl.c#200~30110~      2007-02-03 11:00:21.000000000 -0800
+++ perl/perl.c 2007-02-04 13:32:10.000000000 -0800
@@ -137,41 +137,33 @@
 #endif
 #endif
 
+static void
+S_init_tls_and_interp(PerlInterpreter *my_perl)
+{
+    if (!PL_curinterp) {                       
+       PERL_SET_INTERP(my_perl);
 #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)
-#  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);
 #  endif
 #endif
+    }
+}
 
 #ifdef PERL_IMPLICIT_SYS
 PerlInterpreter *
@@ -184,7 +176,7 @@
     PerlInterpreter *my_perl;
     /* Newx() needs interpreter, so call malloc() instead */
     my_perl = (PerlInterpreter*)(*ipM->pMalloc)(ipM, sizeof(PerlInterpreter));
-    INIT_TLS_AND_INTERP;
+    S_init_tls_and_interp(my_perl);
     Zero(my_perl, 1, PerlInterpreter);
     PL_Mem = ipM;
     PL_MemShared = ipMS;
@@ -222,7 +214,7 @@
     /* Newx() needs interpreter, so call malloc() instead */
     my_perl = (PerlInterpreter*)PerlMem_malloc(sizeof(PerlInterpreter));
 
-    INIT_TLS_AND_INTERP;
+    S_init_tls_and_interp(my_perl);
 #ifndef PERL_TRACK_MEMPOOL
     return (PerlInterpreter *) ZeroD(my_perl, 1, PerlInterpreter);
 #else
End of Patch.

Reply via email to