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

RE: threads module falsely assumes that its BOOT section is executed only once per process

From:
Jan Dubois
Date:
October 27, 2006 13:26
Subject:
RE: threads module falsely assumes that its BOOT section is executed only once per process
Message ID:
016001c6fa06$11a399c0$34eacd40$@com
Dave writes:
> An "easy" fix for this is to add a new per-interpreter var, PL_ithread say,
> and use this to point to the ithread structure. Then ditch calling
> MY_CXT_CLONE, making the MY_CXT vars per interpreter pool rather than per
> interpreter, then shove tid_counter et al. there.

I don't think you need an "explicit" per-interpreter variable.
There is nothing that prevents you from using 2 MY_CXT structures in
the module, one that is per-interpreter (reallocated in CLONE)
and one that will be global to the pool.  The global one would need
to store its tid in the structure during BOOT time so that the same
interpreter can tear it down.

Well, the MY_CXT macro may not support this directly, but they are
just syntactic sugar around storing values in the PL_modglobal hash
to avoid the hash access if you compile without MULTIPLICITY.

Cheers,
-Jan




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