1 package autovivification::TestThreads;
6 use Config qw<%Config>;
13 require autovivification;
15 skip_all 'This autovivification isn\'t thread safe'
16 unless autovivification::A_THREADSAFE();
18 my $force = $ENV{PERL_AUTOVIVIFICATION_TEST_THREADS} ? 1 : !1;
19 skip_all 'This perl wasn\'t built to support threads'
20 unless $Config{useithreads};
21 skip_all 'perl 5.13.4 required to test thread safety'
22 unless $force or "$]" >= 5.013_004;
24 load_or_skip_all('threads', $force ? '0' : '1.67', [ ]);
31 while (my ($name, $code) = each %exports) {
33 *{$pkg.'::'.$name} = $code;
41 local $SIG{__WARN__} = sub { push @diag, "Thread creation warning: @_" };
44 push @diag, "Thread creation error: $@" if $@;
47 Test::Leaner::diag($_) for @diag;
49 return $thread ? $thread : ();