diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-15 06:39:37 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-15 06:39:37 +0000 |
commit | 8d6d311fabe59c7254b0415be859fecd0189b261 (patch) | |
tree | 574d33c9490742cb3779512b747a6ef0ff849db7 /t | |
parent | faa19ec978675c2fae1b6983f7a664c598dbf44e (diff) | |
download | perl-8d6d311fabe59c7254b0415be859fecd0189b261.tar.gz |
add a few more thread.t tests
p4raw-id: //depot/perl@1504
Diffstat (limited to 't')
-rwxr-xr-x | t/lib/thread.t | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/t/lib/thread.t b/t/lib/thread.t index d6f69ce0d9..fecfb0304a 100755 --- a/t/lib/thread.t +++ b/t/lib/thread.t @@ -11,7 +11,7 @@ BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0; # XXX known trouble with global destruction } $| = 1; -print "1..12\n"; +print "1..14\n"; use Thread; print "ok 1\n"; @@ -32,23 +32,40 @@ print $t->join; } $t->join; -sub islocked +sub dorecurse { my $val = shift; my $ret; print $val; if (@_) { - $ret = Thread->new(\&islocked, @_); + $ret = Thread->new(\&dorecurse, @_); $ret->join; } } -$t = new Thread \&islocked, map { "ok $_\n" } 6..10; +$t = new Thread \&dorecurse, map { "ok $_\n" } 6..10; $t->join; # test that sleep lets other thread run -$t = new Thread \&islocked,"ok 11\n"; +$t = new Thread \&dorecurse,"ok 11\n"; sleep 6; print "ok 12\n"; $t->join; + +sub islocked +{ + use attrs 'locked'; + my $val = shift; + my $ret; + print $val; + if (@_) + { + $ret = Thread->new(\&islocked, shift); + } + $ret; +} + +$t = Thread->new(\&islocked, "ok 13\n", "ok 14\n"); +$t->join->join; + |