This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Turn $$ into a magical readonly variable that always fetches getpid() instead of...
authorMax Maischein <corion@corion.net>
Mon, 23 May 2011 04:36:57 +0000 (21:36 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 23 May 2011 04:50:50 +0000 (21:50 -0700)
commit0e21945565eb4664d843bb819fb032cedee4d5a6
treeb5b5ab6ecccabc65812e44ac0a5baefa3f5e5000
parent369fb445f856204b1f9717b96bde7cd9bb9da369
Turn $$ into a magical readonly variable that always fetches getpid() instead of caching it

The intent is that by not caching $$, we eliminate one opportunity for bugs:
If one embeds Perl or uses XS and calls fork(3) from C, Perls notion of $$
may go out of sync with what getpid() returns. By always fetching the
value of $$ via getpid(), this bug opportunity is eliminated. The overhead
of always fetching $$ should be small and is likely only used for tempfile
creation, which should be dwarfed by file system accesses.
gv.c
mg.c
perl.c
pp_sys.c
util.c
win32/perlhost.h