X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2Fthread.t;h=6c2540785339b8e9625eb426559c3a8f1c92a6ca;hb=1d7c184104c076988718a01b77c8706aae05b092;hp=83407a9fab6a4b48043b7d51543c14ad4ccc14c9;hpb=9c63ababe730a679456af7dbae670cea805c3751;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/lib/thread.t b/t/lib/thread.t index 83407a9..6c25407 100755 --- a/t/lib/thread.t +++ b/t/lib/thread.t @@ -2,10 +2,10 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; + unshift @INC, '../lib'; require Config; import Config; if (! $Config{'usethreads'}) { - print "1..0\n"; + print "1..0 # Skip: this perl is not threaded\n"; exit 0; } @@ -13,7 +13,7 @@ BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3; } $| = 1; -print "1..14\n"; +print "1..18\n"; use Thread; print "ok 1\n"; @@ -24,7 +24,7 @@ sub content } # create a thread passing args and immedaietly wait for it. -my $t = new Thread \&content,("ok 2\n","ok 3\n"); +my $t = new Thread \&content,("ok 2\n","ok 3\n", 1..1000); print $t->join; # check that lock works ... @@ -55,9 +55,7 @@ sleep 6; print "ok 12\n"; $t->join; -sub islocked -{ - use attrs 'locked'; +sub islocked : locked { my $val = shift; my $ret; print $val; @@ -71,3 +69,16 @@ sub islocked $t = Thread->new(\&islocked, "ok 13\n", "ok 14\n"); $t->join->join; +{ + package Loch::Ness; + sub new { bless [], shift } + sub monster : locked, method { + my($s, $m) = @_; + print "ok $m\n"; + } + sub gollum { &monster } +} +Loch::Ness->monster(15); +Loch::Ness->new->monster(16); +Loch::Ness->gollum(17); +Loch::Ness->new->gollum(18);