print("1..18\n"); ### Number of tests that will be run ###
};
-use threads ('stack_size' => 32*4096);
+use threads ('stack_size' => 128*4096);
ok(1, 1, 'Loaded');
### Start of Testing ###
-ok(2, threads->get_stack_size() == 32*4096,
+ok(2, threads->get_stack_size() == 128*4096,
'Stack size set in import');
-ok(3, threads->set_stack_size(64*4096) == 32*4096,
+ok(3, threads->set_stack_size(160*4096) == 128*4096,
'Set returns previous value');
-ok(4, threads->get_stack_size() == 64*4096,
+ok(4, threads->get_stack_size() == 160*4096,
'Get stack size');
threads->create(
sub {
- ok(5, threads->get_stack_size() == 64*4096,
+ ok(5, threads->get_stack_size() == 160*4096,
'Get stack size in thread');
- ok(6, threads->self()->get_stack_size() == 64*4096,
+ ok(6, threads->self()->get_stack_size() == 160*4096,
'Thread gets own stack size');
- ok(7, threads->set_stack_size(32*4096) == 64*4096,
+ ok(7, threads->set_stack_size(128*4096) == 160*4096,
'Thread changes stack size');
- ok(8, threads->get_stack_size() == 32*4096,
+ ok(8, threads->get_stack_size() == 128*4096,
'Get stack size in thread');
- ok(9, threads->self()->get_stack_size() == 64*4096,
+ ok(9, threads->self()->get_stack_size() == 160*4096,
'Thread stack size unchanged');
}
)->join();
-ok(10, threads->get_stack_size() == 32*4096,
+ok(10, threads->get_stack_size() == 128*4096,
'Default thread sized changed in thread');
threads->create(
- { 'stack' => 64*4096 },
+ { 'stack' => 160*4096 },
sub {
- ok(11, threads->get_stack_size() == 32*4096,
+ ok(11, threads->get_stack_size() == 128*4096,
'Get stack size in thread');
- ok(12, threads->self()->get_stack_size() == 64*4096,
+ ok(12, threads->self()->get_stack_size() == 160*4096,
'Thread gets own stack size');
}
)->join();
-my $thr = threads->create( { 'stack' => 64*4096 }, sub { } );
+my $thr = threads->create( { 'stack' => 160*4096 }, sub { } );
$thr->create(
sub {
- ok(13, threads->get_stack_size() == 32*4096,
+ ok(13, threads->get_stack_size() == 128*4096,
'Get stack size in thread');
- ok(14, threads->self()->get_stack_size() == 64*4096,
+ ok(14, threads->self()->get_stack_size() == 160*4096,
'Thread gets own stack size');
}
)->join();
$thr->create(
- { 'stack' => 48*4096 },
+ { 'stack' => 144*4096 },
sub {
- ok(15, threads->get_stack_size() == 32*4096,
+ ok(15, threads->get_stack_size() == 128*4096,
'Get stack size in thread');
- ok(16, threads->self()->get_stack_size() == 48*4096,
+ ok(16, threads->self()->get_stack_size() == 144*4096,
'Thread gets own stack size');
- ok(17, threads->set_stack_size(64*4096) == 32*4096,
+ ok(17, threads->set_stack_size(160*4096) == 128*4096,
'Thread changes stack size');
}
)->join();
$thr->join();
-ok(18, threads->get_stack_size() == 64*4096,
+ok(18, threads->get_stack_size() == 160*4096,
'Default thread sized changed in thread');
# EOF
use ExtUtils::testlib;
+my $test = 0;
sub ok {
- my ($id, $ok, $name) = @_;
+ my ($ok, $name) = @_;
+ $test++;
# You have to do it this way or VMS will get confused.
if ($ok) {
- print("ok $id - $name\n");
+ print("ok $test - $name\n");
} else {
- print("not ok $id - $name\n");
+ print("not ok $test - $name\n");
printf("# Failed test at line %d\n", (caller)[2]);
}
BEGIN {
$| = 1;
- print("1..63\n"); ### Number of tests that will be run ###
+ print("1..61\n"); ### Number of tests that will be run ###
};
use threads;
-ok(1, 1, 'Loaded');
+ok(1, 'Loaded');
### Start of Testing ###
+my $cnt = 30;
+
my @threads;
-for (2..32) {
- ok($_, 1, "Multiple thread test");
- push(@threads , threads->create(sub {
- my $i = shift;
- for (1..500000) { $i++ }
- }, $_));
+for (1..$cnt) {
+ my $thr = threads->create(sub { my $ii = shift;
+ for (1..500000) { $ii++ } }, $_);
+ ok($thr, "Thread created - iter $_");
+ push(@threads, $thr);
}
-my $i = 33;
-for (@threads) {
- $_->join;
- ok($i++, 1 ,"Thread joined");
+for (1..$cnt) {
+ my ($result, $thr);
+ $thr = $threads[$_-1];
+ $result = $thr->join if $thr;
+ ok($thr, "Thread joined - iter $_");
}
# EOF
use ExtUtils::testlib;
+my $test = 0;
sub ok {
- my ($id, $ok, $name) = @_;
+ my ($ok, $name) = @_;
+ $test++;
# You have to do it this way or VMS will get confused.
if ($ok) {
- print("ok $id - $name\n");
+ print("ok $test - $name\n");
} else {
- print("not ok $id - $name\n");
+ print("not ok $test - $name\n");
printf("# Failed test at line %d\n", (caller)[2]);
}
BEGIN {
$| = 1;
- print("1..31\n"); ### Number of tests that will be run ###
+ print("1..61\n"); ### Number of tests that will be run ###
};
use threads;
-ok(1, 1, 'Loaded');
+ok(1, 'Loaded');
### Start of Testing ###
my @threads;
for (1..$cnt) {
- push(@threads, threads->create('stress_re', $_));
+ my $thr = threads->create('stress_re', $_);
+ ok($thr, "Thread created - iter $_");
+ push(@threads, $thr);
}
for (1..$cnt) {
- my $result = $threads[$_-1]->join;
- ok($_+1, defined($result) && ($result eq 'ok'), "stress re - iter $_");
+ my ($result, $thr);
+ $thr = $threads[$_-1];
+ $result = $thr->join if $thr;
+ ok($thr && defined($result) && ($result eq 'ok'), "Thread joined - iter $_");
}
# EOF
use ExtUtils::testlib;
+my $test = 0;
sub ok {
- my ($id, $ok, $name) = @_;
+ my ($ok, $name) = @_;
+ $test++;
# You have to do it this way or VMS will get confused.
if ($ok) {
- print("ok $id - $name\n");
+ print("ok $test - $name\n");
} else {
- print("not ok $id - $name\n");
+ print("not ok $test - $name\n");
printf("# Failed test at line %d\n", (caller)[2]);
}
BEGIN {
$| = 1;
- print("1..63\n"); ### Number of tests that will be run ###
+ print("1..61\n"); ### Number of tests that will be run ###
};
use threads;
-ok(1, 1, 'Loaded');
+ok(1, 'Loaded');
### Start of Testing ###
+my $cnt = 30;
+
sub test9 {
my $i = shift;
for (1..500000) { $i++ };
}
+
my @threads;
-for (2..32) {
- ok($_, 1, "Multiple thread test");
- push(@threads, threads->create('test9', $_));
+for (1..$cnt) {
+ my $thr = threads->create('test9', $_);
+ ok($thr, "Thread created - iter $_");
+ push(@threads, $thr);
}
-my $i = 33;
-for (@threads) {
- $_->join;
- ok($i++, 1, "Thread joined");
+for (1..$cnt) {
+ my ($result, $thr);
+ $thr = $threads[$_-1];
+ $result = $thr->join if $thr;
+ ok($thr, "Thread joined - iter $_");
}
# EOF