threads 1.71
authorJerry D. Hedden <jdhedden@cpan.org>
Thu, 12 Jun 2008 08:42:19 +0000 (04:42 -0400)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Fri, 13 Jun 2008 17:09:19 +0000 (17:09 +0000)
From: "Jerry D. Hedden" <jdhedden@cpan.org>
Message-ID: <1ff86f510806120542v7f55b0aetac69642e5072654e@mail.gmail.com>

p4raw-id: //depot/perl@34048

22 files changed:
ext/threads/Makefile.PL
ext/threads/t/basic.t
ext/threads/t/blocks.t
ext/threads/t/context.t
ext/threads/t/end.t
ext/threads/t/err.t
ext/threads/t/exit.t
ext/threads/t/free.t
ext/threads/t/free2.t
ext/threads/t/join.t
ext/threads/t/kill.t
ext/threads/t/libc.t
ext/threads/t/list.t
ext/threads/t/problems.t
ext/threads/t/stack.t
ext/threads/t/stack_env.t
ext/threads/t/state.t
ext/threads/t/stress_cv.t
ext/threads/t/stress_re.t
ext/threads/t/stress_string.t
ext/threads/t/thread.t
ext/threads/threads.pm

index 0321738..908a414 100755 (executable)
@@ -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',
index 727f16c..416d371 100755 (executable)
@@ -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
index a9b8963..33a345d 100644 (file)
@@ -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
index 816bfde..ed1c14e 100644 (file)
@@ -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
index 9960633..6aafc4d 100644 (file)
@@ -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
index 9911187..ccfad22 100644 (file)
@@ -67,4 +67,6 @@ $err = $thrx->error();
 isa_ok($err, 'Foo', 'error object');
 is($err->{error}, 'bogus', 'error field');
 
+exit(0);
+
 # EOF
index 5ed2045..e769d0c 100644 (file)
@@ -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
index 46b1bb4..53da950 100644 (file)
@@ -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
index 0a71e01..e5a9b23 100644 (file)
@@ -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
index 7c91def..cd15629 100644 (file)
@@ -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
index 4d741d7..cf0f1b4 100644 (file)
@@ -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
index 740588a..795d577 100644 (file)
@@ -51,4 +51,6 @@ for (1..$i) {
     is($threads[$_]->join(), 0, 'localtime() thread-safe');
 }
 
+exit(0);
+
 # EOF
index 28206df..be769a9 100644 (file)
@@ -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
index b0eddbf..01291b2 100644 (file)
@@ -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
index ea22893..7a171f5 100644 (file)
@@ -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
index 09de083..a2dac06 100644 (file)
@@ -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
index 47ea48c..cda211b 100644 (file)
@@ -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
index 322fb46..b90d700 100644 (file)
@@ -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
index 0a32ab9..b9b9efc 100644 (file)
@@ -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
index 9cd0cd2..e97c25f 100644 (file)
@@ -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
index 951cab5..db006ce 100644 (file)
@@ -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
index 74fd7f3..6bf15d0 100755 (executable)
@@ -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> -