Change 30677 by [EMAIL PROTECTED] on 2007/03/22 08:34:42

        Subject: [PATCH] threads 1.61
        From: "Jerry D. Hedden" <[EMAIL PROTECTED]>
        Date: Wed, 21 Mar 2007 13:15:53 -0700 (PDT)
        Message-ID: <[EMAIL PROTECTED]>
        
        Fix 'list/array' context - both keywords are supported

Affected files ...

... //depot/perl/ext/threads/Changes#36 edit
... //depot/perl/ext/threads/README#34 edit
... //depot/perl/ext/threads/t/context.t#5 edit
... //depot/perl/ext/threads/t/exit.t#15 edit
... //depot/perl/ext/threads/t/thread.t#40 edit
... //depot/perl/ext/threads/threads.pm#86 edit
... //depot/perl/ext/threads/threads.xs#139 edit

Differences ...

==== //depot/perl/ext/threads/Changes#36 (xtext) ====
Index: perl/ext/threads/Changes
--- perl/ext/threads/Changes#35~30152~  2007-02-06 14:37:34.000000000 -0800
+++ perl/ext/threads/Changes    2007-03-22 01:34:42.000000000 -0700
@@ -1,5 +1,10 @@
 Revision history for Perl extension threads.
 
+1.61 Wed Mar 21 16:09:15 EDT 2007
+       - Fix 'list/array' context - both keywords are supported
+       - Upgraded ppport.h to Devel::PPPort 3.11
+       - Removed embed.t - unreliable
+
 1.59 - Mon Feb  5 16:05:44 EST 2007
        - POD tweaks per Wolfgang Laun
 

==== //depot/perl/ext/threads/README#34 (xtext) ====
Index: perl/ext/threads/README
--- perl/ext/threads/README#33~30152~   2007-02-06 14:37:34.000000000 -0800
+++ perl/ext/threads/README     2007-03-22 01:34:42.000000000 -0700
@@ -1,4 +1,4 @@
-threads version 1.59
+threads version 1.61
 ====================
 
 This module exposes interpreter threads to the Perl level.

==== //depot/perl/ext/threads/t/context.t#5 (text) ====
Index: perl/ext/threads/t/context.t
--- perl/ext/threads/t/context.t#4~28501~       2006-07-07 07:12:59.000000000 
-0700
+++ perl/ext/threads/t/context.t        2007-03-22 01:34:42.000000000 -0700
@@ -65,7 +65,7 @@
     my $wantarray = wantarray();
 
     if ($wantarray) {
-        ok($context eq 'array', 'Array context');
+        ok($context eq 'array', 'Array/list context');
         return ('array');
     } elsif (defined($wantarray)) {
         ok($context eq 'scalar', 'Scalar context');
@@ -108,8 +108,8 @@
     my $wantarray = threads->wantarray();
 
     if ($wantarray) {
-        ok($context eq 'array', 'Array context');
-        return ('array');
+        ok($context eq 'list', 'Array/list context');
+        return ('list');
     } elsif (defined($wantarray)) {
         ok($context eq 'scalar', 'Scalar context');
         return 'scalar';
@@ -119,11 +119,11 @@
     }
 }
 
-($thr) = threads->create('bar', 'array');
+($thr) = threads->create('bar', 'list');
 my $ctx = $thr->wantarray();
 ok($ctx, 'Implicit array context');
 ($res) = $thr->join();
-ok($res eq 'array', 'Implicit array context');
+ok($res eq 'list', 'Implicit array context');
 
 $thr = threads->create('bar', 'scalar');
 $ctx = $thr->wantarray();
@@ -138,11 +138,11 @@
 $res = $thr->join();
 ok(! defined($res), 'Implicit void context');
 
-$thr = threads->create({'context' => 'array'}, 'bar', 'array');
+$thr = threads->create({'context' => 'list'}, 'bar', 'list');
 $ctx = $thr->wantarray();
 ok($ctx, 'Explicit array context');
 ($res) = $thr->join();
-ok($res eq 'array', 'Explicit array context');
+ok($res eq 'list', 'Explicit array context');
 
 ($thr) = threads->create({'scalar' => 'scalar'}, 'bar', 'scalar');
 $ctx = $thr->wantarray();

==== //depot/perl/ext/threads/t/exit.t#15 (text) ====
Index: perl/ext/threads/t/exit.t
--- perl/ext/threads/t/exit.t#14~30152~ 2007-02-06 14:37:34.000000000 -0800
+++ perl/ext/threads/t/exit.t   2007-03-22 01:34:42.000000000 -0700
@@ -56,7 +56,7 @@
 ok(! defined($rc), 'Exited: threads->exit()');
 
 
-run_perl(prog => 'use threads 1.59;' .
+run_perl(prog => 'use threads 1.61;' .
                  'threads->exit(86);' .
                  'exit(99);',
          nolib => ($ENV{PERL_CORE}) ? 0 : 1,
@@ -104,7 +104,7 @@
 ok(! defined($rc), 'Exited: $thr->set_thread_exit_only');
 
 
-run_perl(prog => 'use threads 1.59 qw(exit thread_only);' .
+run_perl(prog => 'use threads 1.61 qw(exit thread_only);' .
                  'threads->create(sub { exit(99); })->join();' .
                  'exit(86);',
          nolib => ($ENV{PERL_CORE}) ? 0 : 1,
@@ -112,7 +112,7 @@
 is($?>>8, 86, "'use threads 'exit' => 'thread_only'");
 
 
-my $out = run_perl(prog => 'use threads 1.59;' .
+my $out = run_perl(prog => 'use threads 1.61;' .
                            'threads->create(sub {' .
                            '    exit(99);' .
                            '});' .
@@ -125,7 +125,7 @@
 like($out, '1 finished and unjoined', "exit(status) in thread");
 
 
-$out = run_perl(prog => 'use threads 1.59 qw(exit thread_only);' .
+$out = run_perl(prog => 'use threads 1.61 qw(exit thread_only);' .
                         'threads->create(sub {' .
                         '   threads->set_thread_exit_only(0);' .
                         '   exit(99);' .
@@ -139,7 +139,7 @@
 like($out, '1 finished and unjoined', "set_thread_exit_only(0)");
 
 
-run_perl(prog => 'use threads 1.59;' .
+run_perl(prog => 'use threads 1.61;' .
                  'threads->create(sub {' .
                  '   $SIG{__WARN__} = sub { exit(99); };' .
                  '   die();' .

==== //depot/perl/ext/threads/t/thread.t#40 (text) ====
Index: perl/ext/threads/t/thread.t
--- perl/ext/threads/t/thread.t#39~30152~       2007-02-06 14:37:34.000000000 
-0800
+++ perl/ext/threads/t/thread.t 2007-03-22 01:34:42.000000000 -0700
@@ -171,7 +171,7 @@
 
 # bugid #24165
 
-run_perl(prog => 'use threads 1.59;' .
+run_perl(prog => 'use threads 1.61;' .
                  'sub a{threads->create(shift)} $t = a sub{};' .
                  '$t->tid; $t->join; $t->tid',
          nolib => ($ENV{PERL_CORE}) ? 0 : 1,

==== //depot/perl/ext/threads/threads.pm#86 (xtext) ====
Index: perl/ext/threads/threads.pm
--- perl/ext/threads/threads.pm#85~30375~       2007-02-21 05:36:14.000000000 
-0800
+++ perl/ext/threads/threads.pm 2007-03-22 01:34:42.000000000 -0700
@@ -5,7 +5,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '1.59_01';
+our $VERSION = '1.61';
 my $XS_VERSION = $VERSION;
 $VERSION = eval $VERSION;
 
@@ -98,7 +98,7 @@
     # Class method only
     if (ref($class)) {
         require Carp;
-        Carp::croak("Usage: threads->exit(status)");
+        Carp::croak('Usage: threads->exit(status)');
     }
 
     $class->set_thread_exit_only(1);
@@ -138,7 +138,7 @@
 
 =head1 VERSION
 
-This document describes threads version 1.59
+This document describes threads version 1.61
 
 =head1 SYNOPSIS
 
@@ -560,8 +560,10 @@
 
 In the above, the threads object is returned to the parent thread in scalar
 context, and the thread's entry point function C<foo> will be called in list
-context such that the parent thread can receive a list from the C<-E<gt>join()>
-call.  Similarly, if you need the threads object, but your thread will not be
+(array) context such that the parent thread can receive a list (array) from
+the C<-E<gt>join()> call.  (C<'array'> is synonymous with C<'list'>.)
+
+Similarly, if you need the threads object, but your thread will not be
 returning a value (i.e., I<void> context), you would do the following:
 
     my $thr = threads->create({'context' => 'void'}, \&foo);
@@ -957,7 +959,7 @@
 L<http://www.cpanforum.com/dist/threads>
 
 Annotated POD for L<threads>:
-L<http://annocpan.org/~JDHEDDEN/threads-1.59/threads.pm>
+L<http://annocpan.org/~JDHEDDEN/threads-1.61/threads.pm>
 
 L<threads::shared>, L<perlthrtut>
 

==== //depot/perl/ext/threads/threads.xs#139 (xtext) ====
Index: perl/ext/threads/threads.xs
--- perl/ext/threads/threads.xs#138~30375~      2007-02-21 05:36:14.000000000 
-0800
+++ perl/ext/threads/threads.xs 2007-03-22 01:34:42.000000000 -0700
@@ -896,6 +896,8 @@
                 switch (*str) {
                     case 'a':
                     case 'A':
+                    case 'l':
+                    case 'L':
                         context = G_ARRAY;
                         break;
                     case 's':
@@ -913,6 +915,10 @@
                 if (SvTRUE(*hv_fetch(specs, "array", 5, 0))) {
                     context = G_ARRAY;
                 }
+            } else if (hv_exists(specs, "list", 4)) {
+                if (SvTRUE(*hv_fetch(specs, "list", 4, 0))) {
+                    context = G_ARRAY;
+                }
             } else if (hv_exists(specs, "scalar", 6)) {
                 if (SvTRUE(*hv_fetch(specs, "scalar", 6, 0))) {
                     context = G_SCALAR;
End of Patch.

Reply via email to