# Verify that a 'C' compiler is available
if (! have_cc()) {
- die("No 'C' compiler found to build 'threads'\n");
+ die("OS unsupported: ERROR: No 'C' compiler found to build 'threads'\n");
}
push(@conditional_params, 'DEFINE' => '-DHAS_PPPORT_H',
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
ok(33, "$thr1" eq $thr1->tid(), 'Stringify');
$thr1->join();
+exit(0);
+
# EOF
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
- print("1..0 # Skip: threads::shared not available\n");
+ print("1..0 # SKIP threads::shared not available\n");
exit(0);
}
redo if ($COUNT < $TOTAL);
}
+exit(0);
+
# EOF
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
- print("1..0 # Skip: threads::shared not available\n");
+ print("1..0 # SKIP threads::shared not available\n");
exit(0);
}
$res = $thr->join();
ok(! defined($res), 'Explicit void context');
+exit(0);
+
# EOF
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
- print("1..0 # Skip: threads::shared not available\n");
+ print("1..0 # SKIP threads::shared not available\n");
exit(0);
}
}
threads->create(\&thread)->join();
+exit(0);
+
# EOF
isa_ok($err, 'Foo', 'error object');
is($err->{error}, 'bogus', 'error field');
+exit(0);
+
# EOF
ok(! defined($rc), 'Exited: threads->exit()');
-run_perl(prog => 'use threads 1.69;' .
+run_perl(prog => 'use threads 1.71;' .
'threads->exit(86);' .
'exit(99);',
nolib => ($ENV{PERL_CORE}) ? 0 : 1,
ok(! defined($rc), 'Exited: $thr->set_thread_exit_only');
-run_perl(prog => 'use threads 1.69 qw(exit thread_only);' .
+run_perl(prog => 'use threads 1.71 qw(exit thread_only);' .
'threads->create(sub { exit(99); })->join();' .
'exit(86);',
nolib => ($ENV{PERL_CORE}) ? 0 : 1,
is($?>>8, 86, "'use threads 'exit' => 'thread_only'");
}
-my $out = run_perl(prog => 'use threads 1.69;' .
+my $out = run_perl(prog => 'use threads 1.71;' .
'threads->create(sub {' .
' exit(99);' .
'});' .
like($out, '1 finished and unjoined', "exit(status) in thread");
-$out = run_perl(prog => 'use threads 1.69 qw(exit thread_only);' .
+$out = run_perl(prog => 'use threads 1.71 qw(exit thread_only);' .
'threads->create(sub {' .
' threads->set_thread_exit_only(0);' .
' exit(99);' .
like($out, '1 finished and unjoined', "set_thread_exit_only(0)");
-run_perl(prog => 'use threads 1.69;' .
+run_perl(prog => 'use threads 1.71;' .
'threads->create(sub {' .
' $SIG{__WARN__} = sub { exit(99); };' .
' die();' .
$rc = $thr->join();
ok(! defined($rc), 'Exited: threads->exit() in thread warn handler');
+exit(0);
+
# EOF
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
- print("1..0 # Skip: threads::shared not available\n");
+ print("1..0 # SKIP threads::shared not available\n");
exit(0);
}
}
ok($COUNT == 2, "Done - $COUNT threads");
+exit(0);
+
# EOF
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
- print("1..0 # Skip: threads::shared not available\n");
+ print("1..0 # SKIP threads::shared not available\n");
exit(0);
}
if (($] < 5.008002) && ($threads::shared::VERSION < 0.92)) {
- print("1..0 # Skip: Needs threads::shared 0.92 or later\n");
+ print("1..0 # SKIP Needs threads::shared 0.92 or later\n");
exit(0);
}
}
ok($COUNT == 17, "Done - $COUNT threads");
+exit(0);
+
# EOF
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
- print("1..0 # Skip: threads::shared not available\n");
+ print("1..0 # SKIP threads::shared not available\n");
exit(0);
}
}
sub skip {
- ok(1, '# skip: ' . $_[0]);
+ ok(1, '# SKIP ' . $_[0]);
}
$joiner->join;
}
+exit(0);
+
# EOF
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
- print("1..0 # Skip: threads::shared not available\n");
+ print("1..0 # SKIP threads::shared not available\n");
exit(0);
}
eval { $thr->kill('HUP') };
$thr->join();
if ($@ && $@ =~ /safe signals/) {
- print("1..0 # Skip: Not using safe signals\n");
+ print("1..0 # SKIP Not using safe signals\n");
exit(0);
}
ok($thr->kill('TERM') == $thr, 'Ignore signal to terminated thread');
+exit(0);
+
# EOF
is($threads[$_]->join(), 0, 'localtime() thread-safe');
}
+exit(0);
+
# EOF
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
ok(14, scalar @{[threads->list()]} == 0, 'Thread list empty');
ok(15, threads->list() == 0, 'Thread list empty');
+exit(0);
+
# EOF
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
- print("1..0 # Skip: threads::shared not available\n");
+ print("1..0 # SKIP threads::shared not available\n");
exit(0);
}
my $not = eval { Config::myconfig() } ? '' : 'not ';
print "${not}ok $test - Are we able to call Config::myconfig after clone\n";
} else {
- print "ok $test # skip: Are we able to call Config::myconfig after clone\n";
+ print "ok $test # SKIP Are we able to call Config::myconfig after clone\n";
}
$test++;
}
print $@ =~ /disallowed/
? '' : 'not ', "ok $test # TODO $TODO - unique_hash\n";
} else {
- print("ok $test # skip: $TODO - unique_hash\n");
+ print("ok $test # SKIP $TODO - unique_hash\n");
}
$test++;
})->join;
print $@ =~ /^The 'unique' attribute may only be applied to 'our' variables/
? '' : 'not ', "ok $test - $decl\n";
} else {
- print("ok $test # skip: $decl\n");
+ print("ok $test # SKIP $decl\n");
}
$test++;
}
$child = threads->create(sub { return (scalar(keys(%h))); })->join;
is($child, 1, "keys correct in child with restricted hash");
+exit(0);
+
# EOF
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
ok(18, threads->get_stack_size() == 160*4096,
'Default thread sized changed in thread');
+exit(0);
+
# EOF
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
ok(4, threads->get_stack_size() == 144*4096,
'Get stack size');
+exit(0);
+
# EOF
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
- print("1..0 # Skip: threads::shared not available\n");
+ print("1..0 # SKIP threads::shared not available\n");
exit(0);
}
for (threads->list) { $_->join; }
}
+exit(0);
+
# EOF
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
ok($thr, "Thread joined - iter $_");
}
+exit(0);
+
# EOF
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
ok($thr && defined($result) && ($result eq 'ok'), "Thread joined - iter $_");
}
+exit(0);
+
# EOF
}
use Config;
if (! $Config{'useithreads'}) {
- print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+ print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
ok($thr, "Thread joined - iter $_");
}
+exit(0);
+
# EOF
# bugid #24165
-run_perl(prog => 'use threads 1.69;' .
+run_perl(prog => 'use threads 1.71;' .
'sub a{threads->create(shift)} $t = a sub{};' .
'$t->tid; $t->join; $t->tid',
nolib => ($ENV{PERL_CORE}) ? 0 : 1,
"counts of calls to DESTROY");
}
+exit(0);
+
# EOF
use strict;
use warnings;
-our $VERSION = '1.69';
+our $VERSION = '1.71';
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
=head1 VERSION
-This document describes threads version 1.69
+This document describes threads version 1.71
=head1 SYNOPSIS
later, and if the class supports L<shared objects|threads::shared/"OBJECTS">,
you can pass them via L<shared queues| Thread::Queue>.
+=item END blocks in threads
+
+It is possible to add L<END blocks|perlmod/"BEGIN, UNITCHECK, CHECK, INIT and
+END"> to threads by using L<require|perlfunc/"require VERSION"> or
+L<eval|perlfunc/"eval EXPR"> with the appropriate code. These C<END> blocks
+will then be executed when the thread's interpreter is destroyed (i.e., either
+during a C<-E<gt>join()> call, or at program termination).
+
+However, calling any L<threads> methods in such an C<END> block will most
+likely I<fail> (e.g., the application may hang, or generate an error) due to
+mutexes that are needed to control functionality within the L<threads> module.
+
+For this reason, the use of C<END> blocks in threads is B<strongly>
+discouraged.
+
=item Perl Bugs and the CPAN Version of L<threads>
Support for threads extends beyond the code in this module (i.e.,
L<http://www.cpanforum.com/dist/threads>
Annotated POD for L<threads>:
-L<http://annocpan.org/~JDHEDDEN/threads-1.69/threads.pm>
+L<http://annocpan.org/~JDHEDDEN/threads-1.71/threads.pm>
Source repository:
L<http://code.google.com/p/threads-shared/>
Artur Bergman E<lt>sky AT crucially DOT netE<gt>
-threads is released under the same license as Perl.
-
CPAN version produced by Jerry D. Hedden <jdhedden AT cpan DOT org>
+=head1 LICENSE
+
+threads is released under the same license as Perl.
+
=head1 ACKNOWLEDGEMENTS
Richard Soderberg E<lt>perl AT crystalflame DOT netE<gt> -