From: Gurusamy Sarathy Date: Tue, 14 Jul 1998 07:04:54 +0000 (+0000) Subject: tweak t/lib/thread.t X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0f5feb8dcd2bdb835f78952aa842c128d6c5b2aa;p=p5sagit%2Fp5-mst-13.2.git tweak t/lib/thread.t p4raw-id: //depot/perl@1487 --- diff --git a/t/lib/thread.t b/t/lib/thread.t index 6d3fdde..853fa39 100755 --- a/t/lib/thread.t +++ b/t/lib/thread.t @@ -10,7 +10,7 @@ BEGIN { } } $| = 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"; +$t = new Thread \&islocked,"ok 11\n"; sleep 6; -print "ok 9\n"; +print "ok 12\n"; join $t;