develooper Front page | perl.perl5.porters | Postings from April 2006

Re: how should %^H work with lexical pramas

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
April 1, 2006 06:37
Subject:
Re: how should %^H work with lexical pramas
Message ID:
20060401143732.GO32132@plum.flirble.org
On Sat, Apr 01, 2006 at 11:48:50AM +0100, Nicholas Clark wrote:
> On Fri, Mar 31, 2006 at 10:11:44PM +0100, Nicholas Clark wrote:
> > On Fri, Mar 31, 2006 at 06:45:54PM +0100, Nicholas Clark wrote:
> > 
> > > Is PL_compiling.cop_hints shared across threads?
> > 
> > > +    PL_compiling.cop_hints = PL_curcop->cop_hints;
> > > +    /* FIXME - is this threadsafe?  Or is it manipulating a shared
> > > +       resource?  */
> > > +    if (PL_compiling.cop_hints) {
> > > +       PL_compiling.cop_hints->refcounted_he_refcnt++;
> > 
> > Oops. I didn't phrase my question correctly. Is  PL_compiling.cop_hints
> > shared across threads because it's a copy of PL_curcop->cop_hints and
> > PL_curcop is pointing into a data structure that is shared between threads?
> > (And therefore that ++ is a race condition)
> 
> Yes, it is:

I hope someone will answer this:

> I assume that for the duration of the use of the optree in the child, the
> parent is forbidden from cleaning up and destructing?


But meanwhile I solved the problem of race conditions by copying the chain
for the ithreads case (change 27659). So caller can now return %^H inside
string evals, and CPAN will become a happy place full of user pragmas.

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About