if (!$Config{useithreads}) {
require Test::More;
Test::More->import;
- plan(skip_all => 'This Perl wasn\'t built to support threads');
+ plan(skip_all => 'This perl wasn\'t built to support threads');
}
}
use Variable::Magic qw/wizard cast dispell getdata VMG_THREADSAFE/;
if (VMG_THREADSAFE) {
- plan tests => 2 * 16 + 1;
+ plan tests => 2 * (2 * 16 + 1);
} else {
plan skip_all => 'This Variable::Magic isn\'t thread safe';
}
my $destroyed : shared = 0;
+my $sig = undef;
+
sub try {
my $tid = threads->tid();
my $c = 0;
my $wiz = eval {
wizard get => sub { ++$c },
data => sub { $_[1] + $tid },
- free => sub { ++$destroyed };
+ free => sub { ++$destroyed },
+ sig => $sig;
};
is($@, '', "wizard in thread $tid doesn't croak");
isnt($wiz, undef, "wizard in thread $tid is defined");
$t[1]->join;
is($destroyed, 0, 'destructors didn\'t fired');
+
+$destroyed = 0;
+$sig = Variable::Magic::gensig();
+
+@t = map { threads->create(\&try) } 1 .. 2;
+$t[0]->join;
+$t[1]->join;
+
+is($destroyed, 0, 'destructors didn\'t fired');
+