In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/5ea3460bf04be858ac65dd690c9f49c3d1514ea4?hp=47011d98d8138b193bac04ac39d25acbe9b579ba>
- Log ----------------------------------------------------------------- commit 5ea3460bf04be858ac65dd690c9f49c3d1514ea4 Author: jdhedden <[email protected]> Date: Fri May 20 14:59:02 2016 -0400 Upgrade to threads 2.09 For: RT #128197 M Porting/Maintainers.pl M dist/threads/lib/threads.pm M dist/threads/t/exit.t M dist/threads/t/thread.t commit 89e2fe5204324fa39466f06895daa50e855dd629 Author: jdhedden <[email protected]> Date: Fri May 20 14:33:31 2016 -0400 Upgrade to Thread::Queue 3.11 For: RT #128195 M Porting/Maintainers.pl M dist/Thread-Queue/lib/Thread/Queue.pm M dist/Thread-Queue/t/07_lock.t ----------------------------------------------------------------------- Summary of changes: Porting/Maintainers.pl | 4 ++-- dist/Thread-Queue/lib/Thread/Queue.pm | 11 +++++++---- dist/Thread-Queue/t/07_lock.t | 7 ++++--- dist/threads/lib/threads.pm | 16 ++++++++++++++-- dist/threads/t/exit.t | 10 +++++----- dist/threads/t/thread.t | 2 +- 6 files changed, 33 insertions(+), 17 deletions(-) diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 9905417..7ee8d7a 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -1153,7 +1153,7 @@ use File::Glob qw(:case); # correct for this (and Thread::Semaphore, threads, and threads::shared) # to be under dist/ rather than cpan/ 'Thread::Queue' => { - 'DISTRIBUTION' => 'JDHEDDEN/Thread-Queue-3.09.tar.gz', + 'DISTRIBUTION' => 'JDHEDDEN/Thread-Queue-3.11.tar.gz', 'FILES' => q[dist/Thread-Queue], 'EXCLUDED' => [ qr{^examples/}, @@ -1177,7 +1177,7 @@ use File::Glob qw(:case); }, 'threads' => { - 'DISTRIBUTION' => 'JDHEDDEN/threads-2.08.tar.gz', + 'DISTRIBUTION' => 'JDHEDDEN/threads-2.09.tar.gz', 'FILES' => q[dist/threads], 'EXCLUDED' => [ qr{^examples/}, diff --git a/dist/Thread-Queue/lib/Thread/Queue.pm b/dist/Thread-Queue/lib/Thread/Queue.pm index 2f87eed..9f896b7 100644 --- a/dist/Thread-Queue/lib/Thread/Queue.pm +++ b/dist/Thread-Queue/lib/Thread/Queue.pm @@ -3,7 +3,7 @@ package Thread::Queue; use strict; use warnings; -our $VERSION = '3.09'; +our $VERSION = '3.11'; $VERSION = eval $VERSION; use threads::shared 1.21; @@ -304,7 +304,7 @@ Thread::Queue - Thread-safe queues =head1 VERSION -This document describes Thread::Queue version 3.09 +This document describes Thread::Queue version 3.11 =head1 SYNOPSIS @@ -618,8 +618,11 @@ Passing array/hash refs that contain objects may not work for Perl prior to =head1 SEE ALSO -Thread::Queue Discussion Forum on CPAN: -L<http://www.cpanforum.com/dist/Thread-Queue> +Thread::Queue on MetaCPAN: +L<https://metacpan.org/release/Thread-Queue> + +Code repository for CPAN distribution: +L<https://github.com/Dual-Life/Thread-Queue> L<threads>, L<threads::shared> diff --git a/dist/Thread-Queue/t/07_lock.t b/dist/Thread-Queue/t/07_lock.t index f9e258e..b20e060 100644 --- a/dist/Thread-Queue/t/07_lock.t +++ b/dist/Thread-Queue/t/07_lock.t @@ -29,7 +29,7 @@ ok($q, 'New queue'); my $sm = Thread::Semaphore->new(0); my $st = Thread::Semaphore->new(0); -threads->create(sub { +my $thr = threads->create(sub { { lock($q); $sm->up(); @@ -39,13 +39,14 @@ threads->create(sub { my @x = $q->extract(5,2); is_deeply(\@x, [6,7], 'Thread dequeues under lock'); } -})->detach(); +}); $sm->down(); $st->up(); my @x = $q->dequeue_nb(100); is_deeply(\@x, [1..5,8..10], 'Main dequeues'); -threads::yield(); + +$thr->join(); exit(0); diff --git a/dist/threads/lib/threads.pm b/dist/threads/lib/threads.pm index 182c359..67086da 100644 --- a/dist/threads/lib/threads.pm +++ b/dist/threads/lib/threads.pm @@ -5,7 +5,7 @@ use 5.008; use strict; use warnings; -our $VERSION = '2.08'; +our $VERSION = '2.09'; my $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -134,7 +134,7 @@ threads - Perl interpreter-based threads =head1 VERSION -This document describes threads version 2.08 +This document describes threads version 2.09 =head1 WARNING @@ -1061,6 +1061,18 @@ 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 Detached threads and global destruction + +If the main thread exits while there are detached threads which are still +running, then Perl's global destruction phase is not executed because +otherwise certain global structures that control the operation of threads and +that are allocated in the main thread's memory may get destroyed before the +detached thread is destroyed. + +If you are using any code that requires the execution of the global +destruction phase for clean up (e.g., removing temp files), then do not use +detached threads, but rather join all threads before exiting the program. + =item Perl Bugs and the CPAN Version of L<threads> Support for threads extends beyond the code in this module (i.e., diff --git a/dist/threads/t/exit.t b/dist/threads/t/exit.t index d9c4aa7..9e9b7f5 100644 --- a/dist/threads/t/exit.t +++ b/dist/threads/t/exit.t @@ -48,7 +48,7 @@ my $rc = $thr->join(); ok(! defined($rc), 'Exited: threads->exit()'); -run_perl(prog => 'use threads 2.08;' . +run_perl(prog => 'use threads 2.09;' . 'threads->exit(86);' . 'exit(99);', nolib => ($ENV{PERL_CORE}) ? 0 : 1, @@ -98,7 +98,7 @@ $rc = $thr->join(); ok(! defined($rc), 'Exited: $thr->set_thread_exit_only'); -run_perl(prog => 'use threads 2.08 qw(exit thread_only);' . +run_perl(prog => 'use threads 2.09 qw(exit thread_only);' . 'threads->create(sub { exit(99); })->join();' . 'exit(86);', nolib => ($ENV{PERL_CORE}) ? 0 : 1, @@ -108,7 +108,7 @@ run_perl(prog => 'use threads 2.08 qw(exit thread_only);' . is($?>>8, 86, "'use threads 'exit' => 'thread_only'"); } -my $out = run_perl(prog => 'use threads 2.08;' . +my $out = run_perl(prog => 'use threads 2.09;' . 'threads->create(sub {' . ' exit(99);' . '});' . @@ -124,7 +124,7 @@ my $out = run_perl(prog => 'use threads 2.08;' . like($out, qr/1 finished and unjoined/, "exit(status) in thread"); -$out = run_perl(prog => 'use threads 2.08 qw(exit thread_only);' . +$out = run_perl(prog => 'use threads 2.09 qw(exit thread_only);' . 'threads->create(sub {' . ' threads->set_thread_exit_only(0);' . ' exit(99);' . @@ -141,7 +141,7 @@ $out = run_perl(prog => 'use threads 2.08 qw(exit thread_only);' . like($out, qr/1 finished and unjoined/, "set_thread_exit_only(0)"); -run_perl(prog => 'use threads 2.08;' . +run_perl(prog => 'use threads 2.09;' . 'threads->create(sub {' . ' $SIG{__WARN__} = sub { exit(99); };' . ' die();' . diff --git a/dist/threads/t/thread.t b/dist/threads/t/thread.t index 24cf2f3..4bd96d0 100644 --- a/dist/threads/t/thread.t +++ b/dist/threads/t/thread.t @@ -161,7 +161,7 @@ package main; # bugid #24165 -run_perl(prog => 'use threads 2.08;' . +run_perl(prog => 'use threads 2.09;' . 'sub a{threads->create(shift)} $t = a sub{};' . '$t->tid; $t->join; $t->tid', nolib => ($ENV{PERL_CORE}) ? 0 : 1, -- Perl5 Master Repository
