tweak t/lib/thread.t
[p5sagit/p5-mst-13.2.git] / t / lib / thread.t
index 5ac9e5b..853fa39 100755 (executable)
@@ -4,13 +4,13 @@ BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
     require Config; import Config;
-    if ($Config{'ccflags'} !~ /-DUSE_THREADS\b/) {
+    if (! $Config{'usethreads'}) {
        print "1..0\n";
        exit 0;
     }
 }
 $| = 1;
-print "1..9\n";
+print "1..12\n";
 use Thread;
 print "ok 1\n";
 
@@ -36,19 +36,20 @@ sub islocked
  use attrs 'locked';
  my $val = shift;
  my $ret;
+ print $val;
  if (@_)
   {
-   $ret = new Thread \&islocked,shift;
-   sleep 2;
+   $ret = Thread->new(\&islocked, @_);
+   join $ret;
   }
- print $val;
 }
 
-$t = islocked("ok 6\n","ok 7\n");
+$t = new Thread \&islocked, map { "ok $_\n" } 6..10;
+sleep 2;
 join $t;
 
 # test that sleep lets other thread run
-$t = new Thread \&islocked,"ok 8\n";
-sleep 2;
-print "ok 9";
+$t = new Thread \&islocked,"ok 11\n";
+sleep 6;
+print "ok 12\n";
 join $t;