6 use Config qw/%Config/;
9 if (!$Config{useithreads}) {
12 plan(skip_all => 'This perl wasn\'t built to support threads');
21 require autovivification;
22 if (autovivification::A_THREADSAFE()) {
23 plan tests => 10 * 2 * 3 * (1 + 2);
24 defined and diag "Using threads $_" for $threads::VERSION;
26 plan skip_all => 'This autovivification isn\'t thread safe';
34 my $tid = threads->tid();
36 for my $run (1 .. 2) {
40 is $x, undef, "fetch does not autovivify at thread $tid run $run";
44 my $y = exists $x->{foo};
45 is $x, undef, "exists does not autovivify at thread $tid run $run";
49 my $y = delete $x->{foo};
50 is $x, undef, "delete does not autovivify at thread $tid run $run";
55 skip 'Hints aren\'t propagated into eval STRING below perl 5.10' => 3 * 2
59 eval 'my $y = $x->{foo}';
60 is $@, '', "fetch in eval does not croak at thread $tid run $run";
61 is $x, undef, "fetch in eval does not autovivify at thread $tid run $run";
65 eval 'my $y = exists $x->{foo}';
66 is $@, '', "exists in eval does not croak at thread $tid run $run";
67 is $x, undef, "exists in eval does not autovivify at thread $tid run $run";
71 eval 'my $y = delete $x->{foo}';
72 is $@, '', "delete in eval does not croak at thread $tid run $run";
73 is $x, undef, "delete in eval does not autovivify at thread $tid run $run";
80 my @t = map threads->create(\&try), 1 .. 10;