From: Jerry D. Hedden Date: Mon, 6 Aug 2007 15:09:41 +0000 (-0400) Subject: threads 1.64 (repost) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f3086ff03c35517aff5af05759ba67d3712644c6;p=p5sagit%2Fp5-mst-13.2.git threads 1.64 (repost) From: "Jerry D. Hedden" Message-Id: <1ff86f510708061209m130fd1fbxe03dce2351ae37c9@mail.gmail.com> p4raw-id: //depot/perl@31687 --- diff --git a/MANIFEST b/MANIFEST index 9840242..8375e39 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1092,15 +1092,11 @@ ext/Text/Soundex/README README for Text::Soundex 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. diff --git a/ext/threads/Changes b/ext/threads/Changes deleted file mode 100755 index 0ebd9d2..0000000 --- a/ext/threads/Changes +++ /dev/null @@ -1,215 +0,0 @@ -Revision history for Perl extension threads. - -- - - Sundry test suite fixes - -1.63 Tue Jun 26 21:15:27 EDT 2007 - - Avoid double-free of the thread function - - Added reference in POD to perlmod section on thread safety - - Mention leaked and unreferenced scalar warnings in POD - - Removed BEGIN in threads.pm - - Only need to require Config - -1.62 Thu May 17 16:10:49 2007 - - Fixed :all import option - - Fixed problems in test suite - - Subversion repository on Google - -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 - -1.58 Wed Jan 24 13:15:34 EST 2007 - - Fix race conditions on thread destruction (Dave Mitchell) - - Ignore thread return value(s) in void context - - Check for missing args for 'use threads' options - - Check that stack size argument is numeric - -1.57 Wed Dec 20 13:10:26 EST 2006 - - Fixes courtesy of Michael J. Pomraning - Eliminates self joins - Eliminates multiple, simultaneous joins on a thread - Protects thread->state variable with mutexes - Checks that OS join call is successful - -1.56 Fri Dec 15 12:18:47 EST 2006 - - More fixes to test suite - -1.55 Fri Dec 15 11:24:46 EST 2006 - - Fixes to test suite - -1.54 Thu Dec 14 14:12:30 EST 2006 - - Added ->error() method - -1.53 Mon Nov 27 12:08:27 EST 2006 - - Fix for a thread cloning bug - - Fixes to test suite - -1.52 Tue Nov 21 11:04:03 EST 2006 - - Fix compiler warnings - -1.51 Wed Nov 15 14:25:30 EST 2006 - - Thread destruction fix - -1.49 Fri Nov 3 08:33:28 EST 2006 - - Fix a warning message - -1.48 Thu Nov 2 12:33:22 EST 2006 - - Fix for segfault during thread destruction - -1.47 Mon Oct 30 16:02:53 EST 2006 - - Fix t/thread.t crash under Win32 - - Test multiple embedded Perl support - -1.46 Fri Oct 27 19:51:48 EST 2006 - - Support multiple embedded Perls - - Document workaround for non-threadsafe modules - -1.45 Wed Oct 25 14:22:23 EDT 2006 - - Makefile.PL changes for CORE - - Updated POD tests - -1.44 Wed Oct 11 08:55:50 EDT 2006 - - Complain about bad import options - - Added example threads script - -1.43 Fri Oct 6 15:12:07 EDT 2006 - - Stringify threads objects - - Removed 'typemap' file - -1.42 Mon Sep 18 11:17:13 EDT 2006 - - Fixes to tests - - Move $threads::threads outside of BEGIN block - -1.41 Fri Sep 8 19:28:41 EST 2006 - - Race condition fixes - -1.39 Tue Aug 30 12:00:00 EDT 2006 - - Signals are safe in 5.8.0 - - Upgraded ppport.h to Devel::PPPort 3.10 - -1.38 Tue Aug 1 11:48:56 EDT 2006 - - Fixes to tests - -1.37 Fri Jul 21 10:51:36 EDT 2006 - - Revert 'exit' behavior with override - -1.36 Mon Jul 10 15:58:13 EDT 2006 - - Ignore signals sent to terminated threads - -1.35 Mon Jul 10 09:44:47 EDT 2006 - - Upgraded ppport.h to Devel::PPPort 3.09 - - Fix for Borland compiler - -1.34 Thu Jul 6 10:29:37 EDT 2006 - - Added ->is_running, ->is_detached, ->is_joinable, ->wantarray - - Enhanced ->list to return running or joinable threads - -1.33 Mon Jul 3 10:11:20 EDT 2006 - - 'exit' inside a thread silently terminates thread only - - Added 'threads->exit()' (just calls CORE::exit(0)) - - Handle 'die/exit' in thread warn handlers if thread terminates - with a warning - - Give exact accounting of unjoined threads on program termination - - Fix spurious 'failures' from t/blocks.t - - Set correct path to threads module in tests that use test.pl - -1.32 Mon Jun 5 09:27:53 EDT 2006 - - Fix for HP-UX 10.20 pthread_attr_getstacksize usage - - Check for threads::shared in tests - -1.31 Fri May 19 16:06:42 EDT 2006 - - Explicit thread context - -1.29 Thu May 18 16:09:28 EDT 2006 - - Fix warning/core dump from ->create('foo') in BEGIN block - -1.28 Wed May 17 14:33:13 EDT 2006 - - Fix for build failure under older Perl versions - - Skip signalling tests if using unsafe signals - -1.27 Thu May 11 11:52:21 EDT 2006 - - Added $thr->kill() method for thread signalling - - Check for 'C' compiler when building module - -1.26 Mon May 8 13:18:29 EDT 2006 - - Fix for Win32 build WRT page size - -1.25 Thu May 4 12:34:02 EDT 2006 - - Final sync with blead - - Lock counters in tests - -1.24 Mon Apr 24 10:29:11 EDT 2006 - - assert() that thread 0 is never destructed - - Determinancy in free.t - -1.23 Thu Apr 13 16:57:00 EDT 2006 - - BUG (RE)FIX: Properly free thread's Perl interpreter - - It's an error to detach a thread twice - - More XS code cleanups - -1.22 Fri Apr 7 21:35:06 EDT 2006 - - Documented maximum stack size error - -1.21 Tue Apr 4 13:57:23 EDT 2006 - - Corrected ->_handle() to return a pointer - - Overload != - -1.19 Sat Mar 25 18:46:02 EST 2006 - - Use 'DEFINE' instead of 'CCFLAGS' in Makefile.PL - -1.18 Fri Mar 24 14:21:36 EST 2006 - - ->equal returns 0 on false for backwards compatibility - - Changed UVs to IVs in XS code (except for TID) - - Use ->create in tests - -1.17 Thu Mar 23 10:31:20 EST 2006 - - Restoration of 'core' build parameters - -1.15 Wed Mar 22 13:46:51 EST 2006 - - BUG FIX: Replaced SvPV_nolen_const macro - - Disabled closure return test again and added note in POD - -1.14 Tue Mar 21 08:40:16 EST 2006 - - BUG FIX: Corrected UV formatting string - -1.13 Mon Mar 20 15:09:42 EST 2006 - - BUG FIX: Round stack sizes to multiple of page size - - Use PTHREAD_STACK_MIN if available - -1.12 Sun Mar 19 17:34:49 EST 2006 - - Implemented $thr1->equal($thr2) in XS - - Use $ENV{PERL_CORE} in tests - -1.11 Fri Mar 17 13:24:35 EST 2006 - - BUG FIX: Properly free thread's Perl interpreter - - Removed BUGS POD item regarding returning objects from threads - - Enabled closure return test in t/problems.t - - Handle deprecation of :unique in tests - - XS code cleanup - - Better POD coverage - -1.09 Mon Mar 13 14:14:37 EST 2006 - - Initial (re-)release to CPAN - - 64-bit TIDs - - API for thread stack size (courtesy of Dean Arnold) - - Made threads->list() context sensitive - - Implemented threads->object($tid) in XS - - Added $thr->_handle() method - - -Ancient history: - -0.03 Mon Jul 2 12:00:50 CEST 2001 - Fixed bug with threads->self() in main thread, thanks Hackworth! - -0.02 Sat Jun 30 09:41:00 GMT 2001 - Fixed bug in threads->self() reported by Hackworth - -0.01 Tue Apr 24 19:04:12 2001 - Cleaned up documentation - diff --git a/ext/threads/README b/ext/threads/README deleted file mode 100755 index ef29908..0000000 --- a/ext/threads/README +++ /dev/null @@ -1,26 +0,0 @@ -threads version 1.63 -==================== - -This module exposes interpreter threads to the Perl level. - -INSTALLATION - -To install this module type the following: - - perl Makefile.PL - make - make test - make install - -DEPENDENCIES - -This module needs perl 5.8.0 or later compiled with 'useithreads'. - -COPYRIGHT AND LICENCE - -Copyright (C) 2001 Artur Bergman -Same licence as Perl. - -CPAN version produced by Jerry D. Hedden - -# EOF diff --git a/ext/threads/shared/README b/ext/threads/shared/README deleted file mode 100644 index fab93d9..0000000 --- a/ext/threads/shared/README +++ /dev/null @@ -1,29 +0,0 @@ -threads::shared version 1.12 -============================ - -This module needs Perl 5.8.0 or later compiled with USEITHREADS. -It lets you share data structures between threads. - -INSTALLATION - -To install this module type the following: - - perl Makefile.PL - make - make test - make install - -DEPENDENCIES - -This module requires these other modules and libraries: - - threads - -COPYRIGHT AND LICENCE - -Copyright (C) 2001 Artur Bergman -Same licence as Perl. - -CPAN version produced by Jerry D. Hedden - -# EOF diff --git a/ext/threads/t/basic.t b/ext/threads/t/basic.t index e693a00..727f16c 100755 --- a/ext/threads/t/basic.t +++ b/ext/threads/t/basic.t @@ -160,7 +160,7 @@ ok(31, ! defined($thrx), 'No object'); $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(); diff --git a/ext/threads/t/blocks.t b/ext/threads/t/blocks.t index 8c8a766..a9b8963 100644 --- a/ext/threads/t/blocks.t +++ b/ext/threads/t/blocks.t @@ -20,7 +20,7 @@ use threads; 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"); diff --git a/ext/threads/t/context.t b/ext/threads/t/context.t index 0bdac0c..816bfde 100644 --- a/ext/threads/t/context.t +++ b/ext/threads/t/context.t @@ -20,7 +20,7 @@ use threads; 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"); diff --git a/ext/threads/t/end.t b/ext/threads/t/end.t index b1955d9..9960633 100644 --- a/ext/threads/t/end.t +++ b/ext/threads/t/end.t @@ -20,7 +20,7 @@ use threads; 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"); diff --git a/ext/threads/t/exit.t b/ext/threads/t/exit.t index 69b6126..b005f80 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.63;' . +run_perl(prog => 'use threads 1.64;' . '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.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 @@ run_perl(prog => 'use threads 1.63 qw(exit thread_only);' . 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 @@ my $out = run_perl(prog => 'use threads 1.63;' . 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 @@ $out = run_perl(prog => 'use threads 1.63 qw(exit thread_only);' . 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();' . diff --git a/ext/threads/t/free.t b/ext/threads/t/free.t index 5e4d3b8..46b1bb4 100644 --- a/ext/threads/t/free.t +++ b/ext/threads/t/free.t @@ -20,7 +20,7 @@ use threads; 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"); diff --git a/ext/threads/t/free2.t b/ext/threads/t/free2.t index 48e5c00..0a71e01 100644 --- a/ext/threads/t/free2.t +++ b/ext/threads/t/free2.t @@ -20,7 +20,7 @@ use threads; 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"); diff --git a/ext/threads/t/join.t b/ext/threads/t/join.t index 0dd9514..64b846f 100644 --- a/ext/threads/t/join.t +++ b/ext/threads/t/join.t @@ -20,7 +20,7 @@ use threads; 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"); diff --git a/ext/threads/t/kill.t b/ext/threads/t/kill.t index a361ee3..4d741d7 100644 --- a/ext/threads/t/kill.t +++ b/ext/threads/t/kill.t @@ -20,7 +20,7 @@ use threads; 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"); diff --git a/ext/threads/t/problems.t b/ext/threads/t/problems.t index e5f1449..d979b3a 100644 --- a/ext/threads/t/problems.t +++ b/ext/threads/t/problems.t @@ -20,7 +20,7 @@ use threads; 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"); diff --git a/ext/threads/t/state.t b/ext/threads/t/state.t index b786840..47ea48c 100644 --- a/ext/threads/t/state.t +++ b/ext/threads/t/state.t @@ -20,7 +20,7 @@ use threads; 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"); diff --git a/ext/threads/t/thread.t b/ext/threads/t/thread.t index 3e337a4..72c3638 100644 --- a/ext/threads/t/thread.t +++ b/ext/threads/t/thread.t @@ -22,7 +22,7 @@ use threads; 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 @@ package main; # 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, diff --git a/ext/threads/threads.pm b/ext/threads/threads.pm index 8f2d1be..e75d9d5 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.63'; +our $VERSION = '1.64'; my $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -134,7 +134,7 @@ threads - Perl interpreter-based threads =head1 VERSION -This document describes threads version 1.63 +This document describes threads version 1.64 =head1 SYNOPSIS @@ -879,19 +879,43 @@ C if needed): sub thr_func { require Unsafe::Module - # import Unsafe::Module ...; + # Unsafe::Module->import(...); .... } If the module is needed inside the I
thread, try modifying your application so that the module is loaded (again using C and -C) after any threads are started, and in such a way that no other -threads are started afterwards. +C<-Eimport()>) 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 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) 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 calls (e.g., using +C or back-ticks) made from threads use the environment variable +settings from the I
thread. In other words, changes made to C<%ENV> in +a thread will not be visible in I calls made by that thread. + +To work around this, set environment variables as part of the I 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 threads while @@ -966,7 +990,7 @@ L Discussion Forum on CPAN: L Annotated POD for L: -L +L Source repository: L