warn on broken threads rather than skipping
[p5sagit/Devel-GlobalDestruction.git] / t / threads_check.pm
CommitLineData
1035e7c4 1package t::threads_check;
2
3sub _skip {
4 print "1..0 # SKIP $_[0]\n";
5 exit 0;
6}
7
8sub import {
9 my ($class, $op) = @_;
10 if ($0 eq '-' && $op) {
11 if ($op eq 'installed') {
12 eval { require threads } or exit 1;
13 }
14 elsif ($op eq 'create') {
15 require threads;
16 threads->create(sub{ 1 })->join;
17 }
18 exit 0;
19 }
20 require Config;
21 if (! $Config::Config{useithreads}) {
22 _skip "your perl does not support ithreads";
23 }
24 elsif (system "$^X", '-Mt::threads_check=installed') {
25 _skip "threads.pm not installed";
26 }
27 elsif (system "$^X", '-Mt::threads_check=create') {
ec038f2c 28 print STDERR "# threads appear broken on this machine\n";
1035e7c4 29 }
30}
31
321;