Change 31687 by [EMAIL PROTECTED] on 2007/08/08 16:43:49
Subject: [PATCH] threads 1.64 (repost)
From: "Jerry D. Hedden" <[EMAIL PROTECTED]>
Date: Mon, 6 Aug 2007 15:09:41 -0400
Message-Id: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/MANIFEST#1608 edit
... //depot/perl/ext/threads/Changes#40 delete
... //depot/perl/ext/threads/README#37 delete
... //depot/perl/ext/threads/shared/README#10 delete
... //depot/perl/ext/threads/t/basic.t#22 edit
... //depot/perl/ext/threads/t/blocks.t#5 edit
... //depot/perl/ext/threads/t/context.t#6 edit
... //depot/perl/ext/threads/t/end.t#11 edit
... //depot/perl/ext/threads/t/exit.t#19 edit
... //depot/perl/ext/threads/t/free.t#8 edit
... //depot/perl/ext/threads/t/free2.t#6 edit
... //depot/perl/ext/threads/t/join.t#26 edit
... //depot/perl/ext/threads/t/kill.t#8 edit
... //depot/perl/ext/threads/t/problems.t#17 edit
... //depot/perl/ext/threads/t/state.t#4 edit
... //depot/perl/ext/threads/t/thread.t#44 edit
... //depot/perl/ext/threads/threads.pm#89 edit
Differences ...
==== //depot/perl/MANIFEST#1608 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#1607~31651~ 2007-07-24 13:42:14.000000000 -0700
+++ perl/MANIFEST 2007-08-08 09:43:49.000000000 -0700
@@ -1092,15 +1092,11 @@
ext/Text/Soundex/Soundex.pm Text::Soundex extension Perl module
ext/Text/Soundex/Soundex.xs Text::Soundex extension external subroutines
ext/Text/Soundex/t/Soundex.t test for Text::Soundex
-ext/threads/Changes ithreads
ext/threads/hints/hpux.pl Hint file for HPUX
ext/threads/hints/linux.pl Hint file for Linux
ext/threads/Makefile.PL ithreads
-ext/threads/README ithreads
-ext/threads/shared/Changes Changes for threads::shared
ext/threads/shared/hints/linux.pl thread shared variables
ext/threads/shared/Makefile.PL thread shared variables
-ext/threads/shared/README thread shared variables
ext/threads/shared/shared.pm thread shared variables
ext/threads/shared/shared.xs thread shared variables
ext/threads/shared/t/0nothread.t Tests for basic shared array
functionality.
==== //depot/perl/ext/threads/t/basic.t#22 (xtext) ====
Index: perl/ext/threads/t/basic.t
--- perl/ext/threads/t/basic.t#21~28958~ 2006-10-07 09:01:55.000000000
-0700
+++ perl/ext/threads/t/basic.t 2007-08-08 09:43:49.000000000 -0700
@@ -160,7 +160,7 @@
$thrx = threads->object(0);
ok(32, ! defined($thrx), 'No object');
-import threads 'stringify';
+threads->import('stringify');
$thr1 = threads->create(sub {});
ok(33, "$thr1" eq $thr1->tid(), 'Stringify');
$thr1->join();
==== //depot/perl/ext/threads/t/blocks.t#5 (text) ====
Index: perl/ext/threads/t/blocks.t
--- perl/ext/threads/t/blocks.t#4~28475~ 2006-07-04 02:37:10.000000000
-0700
+++ perl/ext/threads/t/blocks.t 2007-08-08 09:43:49.000000000 -0700
@@ -20,7 +20,7 @@
BEGIN {
eval {
require threads::shared;
- import threads::shared;
+ threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
print("1..0 # Skip: threads::shared not available\n");
==== //depot/perl/ext/threads/t/context.t#6 (text) ====
Index: perl/ext/threads/t/context.t
--- perl/ext/threads/t/context.t#5~30677~ 2007-03-22 01:34:42.000000000
-0700
+++ perl/ext/threads/t/context.t 2007-08-08 09:43:49.000000000 -0700
@@ -20,7 +20,7 @@
BEGIN {
eval {
require threads::shared;
- import threads::shared;
+ threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
print("1..0 # Skip: threads::shared not available\n");
==== //depot/perl/ext/threads/t/end.t#11 (text) ====
Index: perl/ext/threads/t/end.t
--- perl/ext/threads/t/end.t#10~28475~ 2006-07-04 02:37:10.000000000 -0700
+++ perl/ext/threads/t/end.t 2007-08-08 09:43:49.000000000 -0700
@@ -20,7 +20,7 @@
BEGIN {
eval {
require threads::shared;
- import threads::shared;
+ threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
print("1..0 # Skip: threads::shared not available\n");
==== //depot/perl/ext/threads/t/exit.t#19 (text) ====
Index: perl/ext/threads/t/exit.t
--- perl/ext/threads/t/exit.t#18~31614~ 2007-07-13 19:21:14.000000000 -0700
+++ perl/ext/threads/t/exit.t 2007-08-08 09:43:49.000000000 -0700
@@ -57,7 +57,7 @@
ok(! defined($rc), 'Exited: threads->exit()');
-run_perl(prog => 'use threads 1.63;' .
+run_perl(prog => 'use threads 1.64;' .
'threads->exit(86);' .
'exit(99);',
nolib => ($ENV{PERL_CORE}) ? 0 : 1,
@@ -107,7 +107,7 @@
ok(! defined($rc), 'Exited: $thr->set_thread_exit_only');
-run_perl(prog => 'use threads 1.63 qw(exit thread_only);' .
+run_perl(prog => 'use threads 1.64 qw(exit thread_only);' .
'threads->create(sub { exit(99); })->join();' .
'exit(86);',
nolib => ($ENV{PERL_CORE}) ? 0 : 1,
@@ -117,7 +117,7 @@
is($?>>8, 86, "'use threads 'exit' => 'thread_only'");
}
-my $out = run_perl(prog => 'use threads 1.63;' .
+my $out = run_perl(prog => 'use threads 1.64;' .
'threads->create(sub {' .
' exit(99);' .
'});' .
@@ -133,7 +133,7 @@
like($out, '1 finished and unjoined', "exit(status) in thread");
-$out = run_perl(prog => 'use threads 1.63 qw(exit thread_only);' .
+$out = run_perl(prog => 'use threads 1.64 qw(exit thread_only);' .
'threads->create(sub {' .
' threads->set_thread_exit_only(0);' .
' exit(99);' .
@@ -150,7 +150,7 @@
like($out, '1 finished and unjoined', "set_thread_exit_only(0)");
-run_perl(prog => 'use threads 1.63;' .
+run_perl(prog => 'use threads 1.64;' .
'threads->create(sub {' .
' $SIG{__WARN__} = sub { exit(99); };' .
' die();' .
==== //depot/perl/ext/threads/t/free.t#8 (text) ====
Index: perl/ext/threads/t/free.t
--- perl/ext/threads/t/free.t#7~31238~ 2007-05-18 15:48:12.000000000 -0700
+++ perl/ext/threads/t/free.t 2007-08-08 09:43:49.000000000 -0700
@@ -20,7 +20,7 @@
BEGIN {
eval {
require threads::shared;
- import threads::shared;
+ threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
print("1..0 # Skip: threads::shared not available\n");
==== //depot/perl/ext/threads/t/free2.t#6 (text) ====
Index: perl/ext/threads/t/free2.t
--- perl/ext/threads/t/free2.t#5~31238~ 2007-05-18 15:48:12.000000000 -0700
+++ perl/ext/threads/t/free2.t 2007-08-08 09:43:49.000000000 -0700
@@ -20,7 +20,7 @@
BEGIN {
eval {
require threads::shared;
- import threads::shared;
+ threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
print("1..0 # Skip: threads::shared not available\n");
==== //depot/perl/ext/threads/t/join.t#26 (text) ====
Index: perl/ext/threads/t/join.t
--- perl/ext/threads/t/join.t#25~29608~ 2006-12-21 02:12:14.000000000 -0800
+++ perl/ext/threads/t/join.t 2007-08-08 09:43:49.000000000 -0700
@@ -20,7 +20,7 @@
BEGIN {
eval {
require threads::shared;
- import threads::shared;
+ threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
print("1..0 # Skip: threads::shared not available\n");
==== //depot/perl/ext/threads/t/kill.t#8 (text) ====
Index: perl/ext/threads/t/kill.t
--- perl/ext/threads/t/kill.t#7~31238~ 2007-05-18 15:48:12.000000000 -0700
+++ perl/ext/threads/t/kill.t 2007-08-08 09:43:49.000000000 -0700
@@ -20,7 +20,7 @@
BEGIN {
eval {
require threads::shared;
- import threads::shared;
+ threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
print("1..0 # Skip: threads::shared not available\n");
==== //depot/perl/ext/threads/t/problems.t#17 (text) ====
Index: perl/ext/threads/t/problems.t
--- perl/ext/threads/t/problems.t#16~28355~ 2006-06-06 04:02:14.000000000
-0700
+++ perl/ext/threads/t/problems.t 2007-08-08 09:43:49.000000000 -0700
@@ -20,7 +20,7 @@
BEGIN {
eval {
require threads::shared;
- import threads::shared;
+ threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
print("1..0 # Skip: threads::shared not available\n");
==== //depot/perl/ext/threads/t/state.t#4 (text) ====
Index: perl/ext/threads/t/state.t
--- perl/ext/threads/t/state.t#3~29608~ 2006-12-21 02:12:14.000000000 -0800
+++ perl/ext/threads/t/state.t 2007-08-08 09:43:49.000000000 -0700
@@ -20,7 +20,7 @@
BEGIN {
eval {
require threads::shared;
- import threads::shared;
+ threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
print("1..0 # Skip: threads::shared not available\n");
==== //depot/perl/ext/threads/t/thread.t#44 (text) ====
Index: perl/ext/threads/t/thread.t
--- perl/ext/threads/t/thread.t#43~31488~ 2007-06-27 23:17:04.000000000
-0700
+++ perl/ext/threads/t/thread.t 2007-08-08 09:43:49.000000000 -0700
@@ -22,7 +22,7 @@
BEGIN {
eval {
require threads::shared;
- import threads::shared;
+ threads::shared->import();
};
if ($@ || ! $threads::shared::threads_shared) {
print("1..0 # Skip: threads::shared not available\n");
@@ -171,7 +171,7 @@
# bugid #24165
-run_perl(prog => 'use threads 1.63;' .
+run_perl(prog => 'use threads 1.64;' .
'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#89 (xtext) ====
Index: perl/ext/threads/threads.pm
--- perl/ext/threads/threads.pm#88~31477~ 2007-06-27 02:59:11.000000000
-0700
+++ perl/ext/threads/threads.pm 2007-08-08 09:43:49.000000000 -0700
@@ -5,7 +5,7 @@
use strict;
use warnings;
-our $VERSION = '1.63';
+our $VERSION = '1.64';
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -134,7 +134,7 @@
=head1 VERSION
-This document describes threads version 1.63
+This document describes threads version 1.64
=head1 SYNOPSIS
@@ -879,19 +879,43 @@
sub thr_func
{
require Unsafe::Module
- # import Unsafe::Module ...;
+ # Unsafe::Module->import(...);
....
}
If the module is needed inside the I<main> thread, try modifying your
application so that the module is loaded (again using C<require> and
-C<import>) after any threads are started, and in such a way that no other
-threads are started afterwards.
+C<-E<gt>import()>) after any threads are started, and in such a way that no
+other threads are started afterwards.
If the above does not work, or is not adequate for your application, then file
a bug report on L<http://rt.cpan.org/Public/> against the problematic module.
+=item Current working directory
+
+On all platforms except MSWin32, the setting for the current working directory
+is shared among all threads such that changing it in one thread (e.g., using
+C<chdir()>) will affect all the threads in the application.
+
+On MSWin32, each thread maintains its own the current working directory
+setting.
+
+=item Environment variables
+
+Currently, on all platforms except MSWin32, all I<system> calls (e.g., using
+C<system()> or back-ticks) made from threads use the environment variable
+settings from the I<main> thread. In other words, changes made to C<%ENV> in
+a thread will not be visible in I<system> calls made by that thread.
+
+To work around this, set environment variables as part of the I<system> call.
+For example:
+
+ my $msg = 'hello';
+ system("FOO=$msg; echo \$FOO"); # Outputs 'hello' to STDOUT
+
+On MSWin32, each thread maintains its own set of environment variables.
+
=item Parent-child threads
On some platforms, it might not be possible to destroy I<parent> threads while
@@ -966,7 +990,7 @@
L<http://www.cpanforum.com/dist/threads>
Annotated POD for L<threads>:
-L<http://annocpan.org/~JDHEDDEN/threads-1.63/threads.pm>
+L<http://annocpan.org/~JDHEDDEN/threads-1.64/threads.pm>
Source repository:
L<http://code.google.com/p/threads-shared/>
End of Patch.