cope better with broken threads
[p5sagit/Devel-GlobalDestruction.git] / t / 02_thread.t
index bcf4878..c5c4afe 100644 (file)
@@ -1,17 +1,4 @@
-use Config;
-BEGIN {
-  unless ($Config{useithreads}) {
-    print "1..0 # SKIP your perl does not support ithreads\n";
-    exit 0;
-  }
-}
-
-BEGIN {
-  unless (eval { require threads }) {
-    print "1..0 # SKIP threads.pm not installed\n";
-    exit 0;
-  }
-}
+use t::threads_check;
 
 use threads;
 use threads::shared;
@@ -24,19 +11,9 @@ use warnings;
 
 BEGIN {
   if ($ENV{DEVEL_GLOBALDESTRUCTION_PP_TEST}) {
-    no strict 'refs';
-    no warnings 'redefine';
-
-    for my $f (qw(DynaLoader::bootstrap XSLoader::load)) {
-      my ($mod) = $f =~ /^ (.+) \:\: [^:]+ $/x;
-      eval "require $mod" or die $@;
-
-      my $orig = \&$f;
-      *$f = sub {
-        die 'no XS' if ($_[0]||'') eq 'Devel::GlobalDestruction';
-        goto $orig;
-      };
-    }
+    unshift @INC, sub {
+      die 'no XS' if $_[1] eq 'Devel/GlobalDestruction/XS.pm';
+    };
   }
 }