diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/threads.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/threads.pm | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/Master/tlpkg/tlperl/lib/threads.pm b/Master/tlpkg/tlperl/lib/threads.pm index 4552e50959b..dc2ef3ea550 100644 --- a/Master/tlpkg/tlperl/lib/threads.pm +++ b/Master/tlpkg/tlperl/lib/threads.pm @@ -5,7 +5,7 @@ use 5.008; use strict; use warnings; -our $VERSION = '1.75'; +our $VERSION = '1.83'; my $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -134,7 +134,7 @@ threads - Perl interpreter-based threads =head1 VERSION -This document describes threads version 1.75 +This document describes threads version 1.83 =head1 SYNOPSIS @@ -361,9 +361,10 @@ key) will cause its ID to be used as the value: =item threads->object($tid) This will return the I<threads> object for the I<active> thread associated -with the specified thread ID. Returns C<undef> if there is no thread -associated with the TID, if the thread is joined or detached, if no TID is -specified or if the specified TID is undef. +with the specified thread ID. If C<$tid> is the value for the current thread, +then this call works the same as C<-E<gt>self()>. Otherwise, returns C<undef> +if there is no thread associated with the TID, if the thread is joined or +detached, if no TID is specified or if the specified TID is undef. =item threads->yield() @@ -902,6 +903,18 @@ 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 Memory consumption + +On most systems, frequent and continual creation and destruction of threads +can lead to ever-increasing growth in the memory footprint of the Perl +interpreter. While it is simple to just launch threads and then +C<-E<gt>join()> or C<-E<gt>detach()> them, for long-lived applications, it is +better to maintain a pool of threads, and to reuse them for the work needed, +using L<queues|Thread::Queue> to notify threads of pending work. The CPAN +distribution of this module contains a simple example +(F<examples/pool_reuse.pl>) illustrating the creation, use and monitoring of a +pool of I<reusable> threads. + =item Current working directory On all platforms except MSWin32, the setting for the current working directory @@ -975,7 +988,7 @@ involved, you may be able to work around this by returning a serialized version of the object (e.g., using L<Data::Dumper> or L<Storable>), and then 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>. +you can pass them via L<shared queues|Thread::Queue>. =item END blocks in threads @@ -992,6 +1005,18 @@ 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 Open directory handles + +In perl 5.14 and higher, on systems other than Windows that do +not support the C<fchdir> C function, directory handles (see +L<opendir|perlfunc/"opendir DIRHANDLE,EXPR">) will not be copied to new +threads. You can use the C<d_fchdir> variable in L<Config.pm|Config> to +determine whether your system supports it. + +In prior perl versions, spawning threads with open directory handles would +crash the interpreter. +L<[perl #75154]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=75154> + =item Perl Bugs and the CPAN Version of L<threads> Support for threads extends beyond the code in this module (i.e., @@ -1020,12 +1045,6 @@ Perl 5.8.0 or later 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.75/threads.pm> - -Source repository: -L<http://code.google.com/p/threads-shared/> - L<threads::shared>, L<perlthrtut> L<http://www.perl.com/pub/a/2002/06/11/threads.html> and |