This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #107366] Don’t clone GVs during thread join
authorFather Chrysostomos <sprout@cpan.org>
Sun, 1 Jan 2012 21:57:06 +0000 (13:57 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 1 Jan 2012 22:02:04 +0000 (14:02 -0800)
commit6eea2b427407da46a602a3ca17cbe055f57c24c0
tree6bcb03e1da4c6a764a21187df990dfa2ae6b7c26
parent8756617677dbda9a9ac19ac3155ca3bbabbf75a8
[perl #107366] Don’t clone GVs during thread join

unless they are orphaned.

This commit stops globs that still reside in their stashes from being
cloned during a join.

That way, a sub like sub{$::x++}, when cloned into a subthread and
returned from it, will still point to the same $::x.

This commit takes the conservative approach of copying on those globs
that can be found under their names in the original thread.

While this doesn’t work for all cases, it’s probably not possible to
make it work all the time.
sv.c
t/op/threads.t