While writing a test case today I discovered a rather wierd bug.

use threads; use strict;
my $i;
sub {$i};
threads->create(sub {})->join();
-

This gives me a Attempt to free unreferenced value in the perl_destruct of
the thread.

just doing 

use threads; use strict;
my $i;
sub {$i};
threads->create(sub {})->join();
sub foo {};
-

or 

use threads; use strict;
my $i;
sub {$i};
threads->create(sub {$i})->join();
-

cures the problem

The problem seems to be that the sub {$i}; CV lives even when it shouldn't
be living and thereofre the SV $i is killed twice. A backtries from
Perl_vmess conforms this. Any attempts to check when the sub {$i} is getting
destroyed is twarted by the bug going away!!!!

A test version of threads.pm is at http://nanisky.com/threads-0.01.tar.gz it
requires the patch in http://nanisky.com/svduppatch.txt to function pass
tests.

Artur


Reply via email to