From: Max Maischein Date: Thu, 17 Dec 2009 22:22:39 +0000 (+0100) Subject: Correct some #ifdef USE_ITHREADS / USE_MULTI X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8703a9a4fd75723318bc4ba1afc42a215806f2d1;p=p5sagit%2Fp5-mst-13.2.git Correct some #ifdef USE_ITHREADS / USE_MULTI --- diff --git a/makedef.pl b/makedef.pl index 6409431..858c1eb 100644 --- a/makedef.pl +++ b/makedef.pl @@ -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 --- 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 --- 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 */