From: Jerry D. Hedden Date: Thu, 12 Jun 2008 08:42:19 +0000 (-0400) Subject: threads 1.71 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=561ee912c48576b809cc3fe50b6a25cc06e0f63f;p=p5sagit%2Fp5-mst-13.2.git threads 1.71 From: "Jerry D. Hedden" Message-ID: <1ff86f510806120542v7f55b0aetac69642e5072654e@mail.gmail.com> p4raw-id: //depot/perl@34048 --- diff --git a/ext/threads/Makefile.PL b/ext/threads/Makefile.PL index 0321738..908a414 100755 --- a/ext/threads/Makefile.PL +++ b/ext/threads/Makefile.PL @@ -55,7 +55,7 @@ if (grep { $_ eq 'PERL_CORE=1' } @ARGV) { # 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', diff --git a/ext/threads/t/basic.t b/ext/threads/t/basic.t index 727f16c..416d371d 100755 --- a/ext/threads/t/basic.t +++ b/ext/threads/t/basic.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -165,4 +165,6 @@ $thr1 = threads->create(sub {}); ok(33, "$thr1" eq $thr1->tid(), 'Stringify'); $thr1->join(); +exit(0); + # EOF diff --git a/ext/threads/t/blocks.t b/ext/threads/t/blocks.t index a9b8963..33a345d 100644 --- a/ext/threads/t/blocks.t +++ b/ext/threads/t/blocks.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -23,7 +23,7 @@ BEGIN { 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); } @@ -123,4 +123,6 @@ ok($bthr->join() == 42, 'BEGIN join'); redo if ($COUNT < $TOTAL); } +exit(0); + # EOF diff --git a/ext/threads/t/context.t b/ext/threads/t/context.t index 816bfde..ed1c14e 100644 --- a/ext/threads/t/context.t +++ b/ext/threads/t/context.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -23,7 +23,7 @@ BEGIN { 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); } @@ -156,4 +156,6 @@ ok(! defined($ctx), 'Explicit void context'); $res = $thr->join(); ok(! defined($res), 'Explicit void context'); +exit(0); + # EOF diff --git a/ext/threads/t/end.t b/ext/threads/t/end.t index 9960633..6aafc4d 100644 --- a/ext/threads/t/end.t +++ b/ext/threads/t/end.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -23,7 +23,7 @@ BEGIN { 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); } @@ -75,4 +75,6 @@ sub thread { } threads->create(\&thread)->join(); +exit(0); + # EOF diff --git a/ext/threads/t/err.t b/ext/threads/t/err.t index 9911187..ccfad22 100644 --- a/ext/threads/t/err.t +++ b/ext/threads/t/err.t @@ -67,4 +67,6 @@ $err = $thrx->error(); isa_ok($err, 'Foo', 'error object'); is($err->{error}, 'bogus', 'error field'); +exit(0); + # EOF diff --git a/ext/threads/t/exit.t b/ext/threads/t/exit.t index 5ed2045..e769d0c 100644 --- a/ext/threads/t/exit.t +++ b/ext/threads/t/exit.t @@ -57,7 +57,7 @@ my $rc = $thr->join(); 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, @@ -107,7 +107,7 @@ $rc = $thr->join(); 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, @@ -117,7 +117,7 @@ run_perl(prog => 'use threads 1.69 qw(exit thread_only);' . 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);' . '});' . @@ -133,7 +133,7 @@ my $out = run_perl(prog => 'use threads 1.69;' . 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);' . @@ -150,7 +150,7 @@ $out = run_perl(prog => 'use threads 1.69 qw(exit thread_only);' . 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();' . @@ -172,4 +172,6 @@ ok($thr, 'Created: threads->exit() in thread warn handler'); $rc = $thr->join(); ok(! defined($rc), 'Exited: threads->exit() in thread warn handler'); +exit(0); + # EOF diff --git a/ext/threads/t/free.t b/ext/threads/t/free.t index 46b1bb4..53da950 100644 --- a/ext/threads/t/free.t +++ b/ext/threads/t/free.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -23,7 +23,7 @@ BEGIN { 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); } @@ -212,4 +212,6 @@ sub threading_3 { } ok($COUNT == 2, "Done - $COUNT threads"); +exit(0); + # EOF diff --git a/ext/threads/t/free2.t b/ext/threads/t/free2.t index 0a71e01..e5a9b23 100644 --- a/ext/threads/t/free2.t +++ b/ext/threads/t/free2.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -23,12 +23,12 @@ BEGIN { 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); } @@ -336,4 +336,6 @@ TEST_STARTS_HERE: } ok($COUNT == 17, "Done - $COUNT threads"); +exit(0); + # EOF diff --git a/ext/threads/t/join.t b/ext/threads/t/join.t index 7c91def..cd15629 100644 --- a/ext/threads/t/join.t +++ b/ext/threads/t/join.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -23,7 +23,7 @@ BEGIN { 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); } @@ -57,7 +57,7 @@ sub ok { } sub skip { - ok(1, '# skip: ' . $_[0]); + ok(1, '# SKIP ' . $_[0]); } @@ -228,4 +228,6 @@ if ($^O eq 'linux') { $joiner->join; } +exit(0); + # EOF diff --git a/ext/threads/t/kill.t b/ext/threads/t/kill.t index 4d741d7..cf0f1b4 100644 --- a/ext/threads/t/kill.t +++ b/ext/threads/t/kill.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -23,7 +23,7 @@ BEGIN { 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); } @@ -32,7 +32,7 @@ BEGIN { 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); } @@ -175,4 +175,6 @@ ok($rc eq 'OKAY', 'Thread return value'); ok($thr->kill('TERM') == $thr, 'Ignore signal to terminated thread'); +exit(0); + # EOF diff --git a/ext/threads/t/libc.t b/ext/threads/t/libc.t index 740588a..795d577 100644 --- a/ext/threads/t/libc.t +++ b/ext/threads/t/libc.t @@ -51,4 +51,6 @@ for (1..$i) { is($threads[$_]->join(), 0, 'localtime() thread-safe'); } +exit(0); + # EOF diff --git a/ext/threads/t/list.t b/ext/threads/t/list.t index 28206df..be769a9 100644 --- a/ext/threads/t/list.t +++ b/ext/threads/t/list.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -69,4 +69,6 @@ $thread->join(); ok(14, scalar @{[threads->list()]} == 0, 'Thread list empty'); ok(15, threads->list() == 0, 'Thread list empty'); +exit(0); + # EOF diff --git a/ext/threads/t/problems.t b/ext/threads/t/problems.t index b0eddbf..01291b2 100644 --- a/ext/threads/t/problems.t +++ b/ext/threads/t/problems.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -23,7 +23,7 @@ BEGIN { 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); } @@ -95,7 +95,7 @@ if ($] != 5.008) 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++; } @@ -123,7 +123,7 @@ threads->create(sub { 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; @@ -138,7 +138,7 @@ for my $decl ('my $x : unique', 'sub foo : unique') { 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++; } @@ -178,4 +178,6 @@ is(keys(%h), 1, "keys correct in parent with restricted hash"); $child = threads->create(sub { return (scalar(keys(%h))); })->join; is($child, 1, "keys correct in child with restricted hash"); +exit(0); + # EOF diff --git a/ext/threads/t/stack.t b/ext/threads/t/stack.t index ea22893..7a171f5 100644 --- a/ext/threads/t/stack.t +++ b/ext/threads/t/stack.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -102,4 +102,6 @@ $thr->join(); ok(18, threads->get_stack_size() == 160*4096, 'Default thread sized changed in thread'); +exit(0); + # EOF diff --git a/ext/threads/t/stack_env.t b/ext/threads/t/stack_env.t index 09de083..a2dac06 100644 --- a/ext/threads/t/stack_env.t +++ b/ext/threads/t/stack_env.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -48,4 +48,6 @@ ok(3, threads->set_stack_size(144*4096) == 128*4096, ok(4, threads->get_stack_size() == 144*4096, 'Get stack size'); +exit(0); + # EOF diff --git a/ext/threads/t/state.t b/ext/threads/t/state.t index 47ea48c..cda211b 100644 --- a/ext/threads/t/state.t +++ b/ext/threads/t/state.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -23,7 +23,7 @@ BEGIN { 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); } @@ -263,4 +263,6 @@ ok(threads->list(threads::joinable) == 0, 'thread joinable list'); for (threads->list) { $_->join; } } +exit(0); + # EOF diff --git a/ext/threads/t/stress_cv.t b/ext/threads/t/stress_cv.t index 322fb46..b90d700 100644 --- a/ext/threads/t/stress_cv.t +++ b/ext/threads/t/stress_cv.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -58,4 +58,6 @@ for (1..$cnt) { ok($thr, "Thread joined - iter $_"); } +exit(0); + # EOF diff --git a/ext/threads/t/stress_re.t b/ext/threads/t/stress_re.t index 0a32ab9..b9b9efc 100644 --- a/ext/threads/t/stress_re.t +++ b/ext/threads/t/stress_re.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -64,4 +64,6 @@ for (1..$cnt) { ok($thr && defined($result) && ($result eq 'ok'), "Thread joined - iter $_"); } +exit(0); + # EOF diff --git a/ext/threads/t/stress_string.t b/ext/threads/t/stress_string.t index 9cd0cd2..e97c25f 100644 --- a/ext/threads/t/stress_string.t +++ b/ext/threads/t/stress_string.t @@ -8,7 +8,7 @@ BEGIN { } 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); } } @@ -62,4 +62,6 @@ for (1..$cnt) { ok($thr, "Thread joined - iter $_"); } +exit(0); + # EOF diff --git a/ext/threads/t/thread.t b/ext/threads/t/thread.t index 951cab5..db006ce 100644 --- a/ext/threads/t/thread.t +++ b/ext/threads/t/thread.t @@ -170,7 +170,7 @@ package main; # 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, @@ -313,4 +313,6 @@ SKIP: { "counts of calls to DESTROY"); } +exit(0); + # EOF diff --git a/ext/threads/threads.pm b/ext/threads/threads.pm index 74fd7f3..6bf15d0 100755 --- a/ext/threads/threads.pm +++ b/ext/threads/threads.pm @@ -5,7 +5,7 @@ use 5.008; use strict; use warnings; -our $VERSION = '1.69'; +our $VERSION = '1.71'; my $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -134,7 +134,7 @@ threads - Perl interpreter-based threads =head1 VERSION -This document describes threads version 1.69 +This document describes threads version 1.71 =head1 SYNOPSIS @@ -967,6 +967,21 @@ reconstituting it in the joining thread. If you're using Perl 5.10.0 or later, and if the class supports L, you can pass them via L. +=item END blocks in threads + +It is possible to add L to threads by using L or +L with the appropriate code. These C blocks +will then be executed when the thread's interpreter is destroyed (i.e., either +during a C<-Ejoin()> call, or at program termination). + +However, calling any L methods in such an C block will most +likely I (e.g., the application may hang, or generate an error) due to +mutexes that are needed to control functionality within the L module. + +For this reason, the use of C blocks in threads is B +discouraged. + =item Perl Bugs and the CPAN Version of L Support for threads extends beyond the code in this module (i.e., @@ -996,7 +1011,7 @@ L Discussion Forum on CPAN: L Annotated POD for L: -L +L Source repository: L @@ -1016,10 +1031,12 @@ L Artur Bergman Esky AT crucially DOT netE -threads is released under the same license as Perl. - CPAN version produced by Jerry D. Hedden +=head1 LICENSE + +threads is released under the same license as Perl. + =head1 ACKNOWLEDGEMENTS Richard Soderberg Eperl AT crystalflame DOT netE -