From: Jarkko Hietaniemi Date: Tue, 3 Dec 2002 12:49:01 +0000 (+0000) Subject: Fix up #18229. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d90a703e9b2a2038e53e20447f0482fe07515888;p=p5sagit%2Fp5-mst-13.2.git Fix up #18229. p4raw-id: //depot/perl@18239 --- diff --git a/embedvar.h b/embedvar.h index 612ebdb..bcf31c7 100644 --- a/embedvar.h +++ b/embedvar.h @@ -894,6 +894,7 @@ #define PL_Yes (PL_Vars.GYes) #define PL_curinterp (PL_Vars.Gcurinterp) #define PL_do_undump (PL_Vars.Gdo_undump) +#define PL_dollarzero_mutex (PL_Vars.Gdollarzero_mutex) #define PL_hexdigit (PL_Vars.Ghexdigit) #define PL_lockhook (PL_Vars.Glockhook) #define PL_malloc_mutex (PL_Vars.Gmalloc_mutex) @@ -913,6 +914,7 @@ #define PL_GYes PL_Yes #define PL_Gcurinterp PL_curinterp #define PL_Gdo_undump PL_do_undump +#define PL_Gdollarzero_mutex PL_dollarzero_mutex #define PL_Ghexdigit PL_hexdigit #define PL_Glockhook PL_lockhook #define PL_Gmalloc_mutex PL_malloc_mutex diff --git a/ext/threads/t/join.t b/ext/threads/t/join.t index 892f48d..230d70c 100644 --- a/ext/threads/t/join.t +++ b/ext/threads/t/join.t @@ -1,4 +1,3 @@ - BEGIN { chdir 't' if -d 't'; @INC = '../lib'; @@ -30,6 +29,10 @@ sub ok { return $ok; } +sub skip { + ok(1, "# Skipped: @_"); +} + ok(1,""); @@ -89,7 +92,6 @@ ok(1,""); } if ($^O eq 'linux') { # We parse ps output so this is OS-dependent. - # First modify $0 in a subthread. print "# 1a: \$0 = $0\n"; join( threads->new( sub { diff --git a/perl.c b/perl.c index bc0c28b..2e3de84 100644 --- a/perl.c +++ b/perl.c @@ -155,6 +155,9 @@ perl_construct(pTHXx) /* Init the real globals (and main thread)? */ if (!PL_linestr) { +#ifdef USE_ITHREADS + MUTEX_INIT(&PL_dollarzero_mutex); /* for $0 modifying */ +#endif #ifdef PERL_FLEXIBLE_EXCEPTIONS PL_protect = MEMBER_TO_FPTR(Perl_default_protect); /* for exceptions */ #endif @@ -918,10 +921,6 @@ setuid perl scripts securely.\n"); oldscope = PL_scopestack_ix; PL_dowarn = G_WARN_OFF; -#ifdef USE_ITHREADS - MUTEX_INIT(&PL_dollarzero_mutex); -#endif - #ifdef PERL_FLEXIBLE_EXCEPTIONS CALLPROTECT(aTHX_ pcur_env, &ret, MEMBER_TO_FPTR(S_vparse_body), env, xsinit); #else diff --git a/perlapi.h b/perlapi.h index 0a75b51..d4b678a 100644 --- a/perlapi.h +++ b/perlapi.h @@ -930,6 +930,8 @@ END_EXTERN_C #define PL_curinterp (*Perl_Gcurinterp_ptr(NULL)) #undef PL_do_undump #define PL_do_undump (*Perl_Gdo_undump_ptr(NULL)) +#undef PL_dollarzero_mutex +#define PL_dollarzero_mutex (*Perl_Gdollarzero_mutex_ptr(NULL)) #undef PL_hexdigit #define PL_hexdigit (*Perl_Ghexdigit_ptr(NULL)) #undef PL_lockhook diff --git a/perlvars.h b/perlvars.h index 0299f8f..0495f1a 100644 --- a/perlvars.h +++ b/perlvars.h @@ -62,3 +62,7 @@ PERLVARI(Gthreadhook, thrhook_proc_t, MEMBER_TO_FPTR(Perl_nothreadhook)) #ifdef THREADS_HAVE_PIDS PERLVARI(Gppid, IV, 0) #endif + +#ifdef USE_ITHREADS +PERLVAR(Gdollarzero_mutex, perl_mutex) /* Modifying $0 */ +#endif diff --git a/pod/perlintern.pod b/pod/perlintern.pod index 0ec74e0..ea5c902 100644 --- a/pod/perlintern.pod +++ b/pod/perlintern.pod @@ -410,7 +410,9 @@ same package can be detected). SvCUR is sometimes hijacked to store the generation number during compilation. If SvFAKE is set on the name SV then slot in the frame AVs are -a REFCNT'ed references to a lexical from "outside". +a REFCNT'ed references to a lexical from "outside". In this case, +the name SV does not have a cop_seq range, since it is in scope +throughout. If the 'name' is '&' the the corresponding entry in frame AV is a CV representing a possible closure.