Upgrade to threads 1.72
[p5sagit/p5-mst-13.2.git] / ext / threads / t / free.t
index 5e4d3b8..87fdae9 100644 (file)
@@ -6,10 +6,16 @@ BEGIN {
         chdir 't';
         unshift @INC, '../lib';
     }
+
+    # Import test.pl into its own package
+    {
+        package Test;
+        require($ENV{PERL_CORE} ? './test.pl' : './t/test.pl');
+    }
+
     use Config;
     if (! $Config{'useithreads'}) {
-        print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
-        exit(0);
+        Test::skip_all(q/Perl not compiled with 'useithreads'/);
     }
 }
 
@@ -18,13 +24,8 @@ use ExtUtils::testlib;
 use threads;
 
 BEGIN {
-    eval {
-        require threads::shared;
-        import threads::shared;
-    };
-    if ($@ || ! $threads::shared::threads_shared) {
-        print("1..0 # Skip: threads::shared not available\n");
-        exit(0);
+    if (! eval 'use threads::shared; 1') {
+        Test::skip_all(q/threads::shared not available/);
     }
 
     require Thread::Queue;
@@ -33,6 +34,7 @@ BEGIN {
     print("1..29\n");   ### Number of tests that will be run ###
 }
 
+Test::watchdog(120);   # In case we get stuck
 
 my $q = Thread::Queue->new();
 my $TEST = 1;
@@ -212,4 +214,6 @@ sub threading_3 {
 }
 ok($COUNT == 2, "Done - $COUNT threads");
 
+exit(0);
+
 # EOF