diff options
author | Jerry D. Hedden <jdhedden@cpan.org> | 2008-06-12 04:42:19 -0400 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2008-06-13 17:09:19 +0000 |
commit | 561ee912c48576b809cc3fe50b6a25cc06e0f63f (patch) | |
tree | 17f5acd1b2ac0f02d5f66edd6064eb62a6285377 /ext/threads | |
parent | 6c791b1568bda9f592749d4c80a9b5eb86201e25 (diff) | |
download | perl-561ee912c48576b809cc3fe50b6a25cc06e0f63f.tar.gz |
threads 1.71
From: "Jerry D. Hedden" <jdhedden@cpan.org>
Message-ID: <1ff86f510806120542v7f55b0aetac69642e5072654e@mail.gmail.com>
p4raw-id: //depot/perl@34048
Diffstat (limited to 'ext/threads')
-rwxr-xr-x | ext/threads/Makefile.PL | 2 | ||||
-rwxr-xr-x | ext/threads/t/basic.t | 4 | ||||
-rw-r--r-- | ext/threads/t/blocks.t | 6 | ||||
-rw-r--r-- | ext/threads/t/context.t | 6 | ||||
-rw-r--r-- | ext/threads/t/end.t | 6 | ||||
-rw-r--r-- | ext/threads/t/err.t | 2 | ||||
-rw-r--r-- | ext/threads/t/exit.t | 12 | ||||
-rw-r--r-- | ext/threads/t/free.t | 6 | ||||
-rw-r--r-- | ext/threads/t/free2.t | 8 | ||||
-rw-r--r-- | ext/threads/t/join.t | 8 | ||||
-rw-r--r-- | ext/threads/t/kill.t | 8 | ||||
-rw-r--r-- | ext/threads/t/libc.t | 2 | ||||
-rw-r--r-- | ext/threads/t/list.t | 4 | ||||
-rw-r--r-- | ext/threads/t/problems.t | 12 | ||||
-rw-r--r-- | ext/threads/t/stack.t | 4 | ||||
-rw-r--r-- | ext/threads/t/stack_env.t | 4 | ||||
-rw-r--r-- | ext/threads/t/state.t | 6 | ||||
-rw-r--r-- | ext/threads/t/stress_cv.t | 4 | ||||
-rw-r--r-- | ext/threads/t/stress_re.t | 4 | ||||
-rw-r--r-- | ext/threads/t/stress_string.t | 4 | ||||
-rw-r--r-- | ext/threads/t/thread.t | 4 | ||||
-rwxr-xr-x | ext/threads/threads.pm | 27 |
22 files changed, 100 insertions, 43 deletions
diff --git a/ext/threads/Makefile.PL b/ext/threads/Makefile.PL index 0321738450..908a4145d3 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 727f16c67d..416d371db9 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 a9b8963255..33a345de50 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 816bfde7db..ed1c14e506 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 9960633c74..6aafc4ddfd 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 9911187e2a..ccfad22f59 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 5ed204530a..e769d0c575 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 46b1bb4180..53da9506df 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 0a71e017f9..e5a9b23fe6 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 7c91defccb..cd15629e2f 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 4d741d7c2a..cf0f1b4fa4 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 740588ae4e..795d577fda 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 28206df629..be769a9029 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 b0eddbfa11..01291b24c6 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 ea228933d8..7a171f5062 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 09de083a29..a2dac06051 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 47ea48c3d4..cda211bca5 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 322fb46c99..b90d700d19 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 0a32ab9d8e..b9b9efc035 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 9cd0cd2aa9..e97c25f9b8 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 951cab52cf..db006ced80 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 74fd7f3766..6bf15d04d4 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<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., @@ -996,7 +1011,7 @@ L<threads> Discussion Forum on CPAN: 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/> @@ -1016,10 +1031,12 @@ L<http://www.perlmonks.org/?node_id=532956> 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> - |