diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-02-24 17:15:41 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-05-24 15:50:57 +0100 |
commit | d08d57ef17162c52e2024a3ba6755f778acbc697 (patch) | |
tree | 0faa95f64ed1d63936c793a6a68eab0efd701c0f /t/op | |
parent | 1db366cc74404c47243e1d86efa59c6559db818e (diff) | |
download | perl-d08d57ef17162c52e2024a3ba6755f778acbc697.tar.gz |
Better ithreads cloning - add all SVs with a 0 refcnt to the temps stack.
Track all SVs created by sv_dup() that have a 0 reference count. If they still
have a 0 reference count at the end of cloning, assign a reference to each to
the temps stack. As the temps stack is cleared at thread exit, SVs book keeping
will be correct and consistent before perl_destruct() makes its check for
leaked scalars.
Remove special case code for checking each @_ and the parent's temp stack.
Diffstat (limited to 't/op')
-rw-r--r-- | t/op/threads.t | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/t/op/threads.t b/t/op/threads.t index d9fed9b6fe..364045d995 100644 --- a/t/op/threads.t +++ b/t/op/threads.t @@ -16,7 +16,7 @@ BEGIN { exit 0; } - plan(19); + plan(20); } use strict; @@ -253,4 +253,14 @@ fresh_perl_like(<<'EOI', qr/\AThread 1 terminated abnormally: Not a CODE referen print "end"; EOI +fresh_perl_is(<<'EOI', 'ok', { }, '0 refcnt neither on tmps stack nor in @_'); + use threads; + my %h = (1, []); + use Scalar::Util 'weaken'; + my $a = $h{1}; + weaken($a); + delete $h{1} && threads->create(sub {}, shift)->join(); + print 'ok'; +EOI + # EOF |