This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Correct some #ifdef USE_ITHREADS / USE_MULTI
authorMax Maischein <corion@corion.net>
Thu, 17 Dec 2009 22:22:39 +0000 (23:22 +0100)
committerJan Dubois <jand@activestate.com>
Thu, 17 Dec 2009 23:32:44 +0000 (15:32 -0800)
makedef.pl
perl.c
util.c

index 6409431..858c1eb 100644 (file)
@@ -758,6 +758,7 @@ unless ($define{'USE_ITHREADS'}) {
                    PL_sharedsv_space_mutex
                    PL_dollarzero_mutex
                    PL_hints_mutex
+                   PL_my_ctx_mutex
                    PL_perlio_mutex
                    PL_regdupe
                    Perl_parser_dup
@@ -793,7 +794,6 @@ unless ($define{'USE_ITHREADS'}) {
 
 unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
     skip_symbols [qw(
-                   PL_my_ctx_mutex
                    PL_my_cxt_index
                    PL_my_cxt_list
                    PL_my_cxt_size
diff --git a/perl.c b/perl.c
index e5039f9..364391c 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -108,8 +108,6 @@ S_init_tls_and_interp(PerlInterpreter *my_perl)
        OP_REFCNT_INIT;
        HINTS_REFCNT_INIT;
        MUTEX_INIT(&PL_dollarzero_mutex);
-#  endif
-#ifdef PERL_IMPLICIT_CONTEXT
        MUTEX_INIT(&PL_my_ctx_mutex);
 #  endif
     }
diff --git a/util.c b/util.c
index 0aab786..70f5a26 100644 (file)
--- a/util.c
+++ b/util.c
@@ -5837,9 +5837,13 @@ Perl_my_cxt_init(pTHX_ int *index, size_t size)
     PERL_ARGS_ASSERT_MY_CXT_INIT;
     if (*index == -1) {
        /* this module hasn't been allocated an index yet */
+#if defined(USE_ITHREADS)
        MUTEX_LOCK(&PL_my_ctx_mutex);
+#endif
        *index = PL_my_cxt_index++;
+#if defined(USE_ITHREADS)
        MUTEX_UNLOCK(&PL_my_ctx_mutex);
+#endif
     }
     
     /* make sure the array is big enough */
@@ -5894,9 +5898,13 @@ Perl_my_cxt_init(pTHX_ const char *my_cxt_key, size_t size)
     index = Perl_my_cxt_index(aTHX_ my_cxt_key);
     if (index == -1) {
        /* this module hasn't been allocated an index yet */
+#if defined(USE_ITHREADS)
        MUTEX_LOCK(&PL_my_ctx_mutex);
+#endif
        index = PL_my_cxt_index++;
+#if defined(USE_ITHREADS)
        MUTEX_UNLOCK(&PL_my_ctx_mutex);
+#endif
     }
 
     /* make sure the array is big enough */