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.013_004;
23 load_or_skip_all('threads', $force ? '0' : '1.67', [ ]);
30 while (my ($name, $code) = each %exports) {
32 *{$pkg.'::'.$name} = $code;
40 local $SIG{__WARN__} = sub { push @diag, "Thread creation warning: @_" };
43 push @diag, "Thread creation error: $@" if $@;
46 Test::Leaner::diag($_) for @diag;
48 return $thread ? $thread : ();