1 package indirect::TestThreads;
6 use Config qw<%Config>;
15 skip_all 'This indirect isn\'t thread safe' unless indirect::I_THREADSAFE();
17 my $force = $ENV{PERL_INDIRECT_TEST_THREADS} ? 1 : !1;
18 skip_all 'This perl wasn\'t built to support threads'
19 unless $Config{useithreads};
20 skip_all 'perl 5.13.4 required to test thread safety'
21 unless $force or "$]" >= 5.013004;
23 load_or_skip('threads', $force ? '0' : '1.67', [ ],
24 'required to test thread safety');
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 : ();