diff options
author | Artur Bergman <sky@nanisky.com> | 2001-09-26 11:36:23 +0000 |
---|---|---|
committer | Artur Bergman <sky@nanisky.com> | 2001-09-26 11:36:23 +0000 |
commit | 3dbf27b4f1cd29258f4cee869f64ad8c82b743ac (patch) | |
tree | 2010369e8f4b7eb37e5f481c1c50c49f7717d116 /ext | |
parent | a521c331db5145b11f7fbed87e4c89652b87294b (diff) | |
download | perl-3dbf27b4f1cd29258f4cee869f64ad8c82b743ac.tar.gz |
Increase the amount of time we spend in each thread, and add one that uses an anonymous sub.
We are using a "delay" here because we do not want to depend on thread synchronization issues.
p4raw-id: //depot/perl@12230
Diffstat (limited to 'ext')
-rw-r--r-- | ext/threads/t/stress_cv.t | 48 | ||||
-rw-r--r-- | ext/threads/t/stress_string.t | 4 |
2 files changed, 50 insertions, 2 deletions
diff --git a/ext/threads/t/stress_cv.t b/ext/threads/t/stress_cv.t new file mode 100644 index 0000000000..eb2bab1a98 --- /dev/null +++ b/ext/threads/t/stress_cv.t @@ -0,0 +1,48 @@ +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; + require Config; import Config; + unless ($Config{'useithreads'}) { + print "1..0 # Skip: no useithreads\n"; + exit 0; + } +} + +use ExtUtils::testlib; +use strict; +BEGIN { print "1..64\n" }; +use threads; + + +print "ok 1\n"; + + + + +sub ok { + my ($id, $ok, $name) = @_; + + # You have to do it this way or VMS will get confused. + print $ok ? "ok $id - $name\n" : "not ok $id - $name\n"; + + printf "# Failed test at line %d\n", (caller)[2] unless $ok; + + return $ok; +} + + +ok(2,1,""); + + +my @threads; +for(3..33) { + ok($_,1,"Multiple thread test"); + push @threads ,threads->create(sub { my $i = shift; for(1..500000) { $i++}},$_); +} + +my $i = 34; +for(@threads) { + $_->join; + ok($i++,1,"Thread joined"); +} + diff --git a/ext/threads/t/stress_string.t b/ext/threads/t/stress_string.t index fb87c6cb22..23449d257b 100644 --- a/ext/threads/t/stress_string.t +++ b/ext/threads/t/stress_string.t @@ -35,14 +35,14 @@ ok(2,1,""); sub test9 { my $i = shift; - for(1..20000) { $i++}; + for(1..500000) { $i++}; } my @threads; for(3..33) { ok($_,1,"Multiple thread test"); push @threads ,threads->create('test9',$_); } -sleep 1; + my $i = 34; for(@threads) { $_->join; |