1 package Lexical::Types::TestThreads;
6 use Config qw<%Config>;
13 require Lexical::Types;
15 skip_all 'This Lexical::Types isn\'t thread safe'
16 unless Lexical::Types::LT_THREADSAFE();
18 my $force = $ENV{PERL_LEXICAL_TYPES_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.013004;
24 load_or_skip('threads', $force ? '0' : '1.67', [ ],
25 'required to test thread safety');
32 while (my ($name, $code) = each %exports) {
34 *{$pkg.'::'.$name} = $code;
42 local $SIG{__WARN__} = sub { push @diag, "Thread creation warning: @_" };
45 push @diag, "Thread creation error: $@" if $@;
48 Test::Leaner::diag($_) for @diag;
50 return $thread ? $thread : ();