diff options
-rw-r--r-- | Changes | 7 | ||||
-rw-r--r-- | META.json | 46 | ||||
-rw-r--r-- | META.yml | 46 | ||||
-rw-r--r-- | Makefile.PL | 46 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | lib/MCE.pm | 40 | ||||
-rw-r--r-- | lib/MCE.pod | 2 | ||||
-rw-r--r-- | lib/MCE/Candy.pm | 4 | ||||
-rw-r--r-- | lib/MCE/Core.pod | 2 | ||||
-rw-r--r-- | lib/MCE/Core/Input/Generator.pm | 2 | ||||
-rw-r--r-- | lib/MCE/Core/Input/Handle.pm | 2 | ||||
-rw-r--r-- | lib/MCE/Core/Input/Iterator.pm | 2 | ||||
-rw-r--r-- | lib/MCE/Core/Input/Request.pm | 2 | ||||
-rw-r--r-- | lib/MCE/Core/Input/Sequence.pm | 2 | ||||
-rw-r--r-- | lib/MCE/Core/Manager.pm | 4 | ||||
-rw-r--r-- | lib/MCE/Core/Validation.pm | 2 | ||||
-rw-r--r-- | lib/MCE/Core/Worker.pm | 10 | ||||
-rw-r--r-- | lib/MCE/Examples.pod | 2 | ||||
-rw-r--r-- | lib/MCE/Flow.pm | 4 | ||||
-rw-r--r-- | lib/MCE/Grep.pm | 4 | ||||
-rw-r--r-- | lib/MCE/Loop.pm | 4 | ||||
-rw-r--r-- | lib/MCE/Map.pm | 4 | ||||
-rw-r--r-- | lib/MCE/Mutex.pm | 4 | ||||
-rw-r--r-- | lib/MCE/Queue.pm | 4 | ||||
-rw-r--r-- | lib/MCE/Relay.pm | 4 | ||||
-rw-r--r-- | lib/MCE/Signal.pm | 4 | ||||
-rw-r--r-- | lib/MCE/Step.pm | 11 | ||||
-rw-r--r-- | lib/MCE/Stream.pm | 11 | ||||
-rw-r--r-- | lib/MCE/Subs.pm | 4 | ||||
-rw-r--r-- | lib/MCE/Util.pm | 14 |
30 files changed, 159 insertions, 136 deletions
@@ -1,7 +1,12 @@ Revision history for Perl module MCE. -1.808 Sat Nov 01 02:00:00 EST 2016 +1.809 Wed Nov 23 16:00:00 EST 2016 + + * Bug fixes for running MCE inside threads. + * Random numbers are unique between workers. + +1.808 Sat Nov 05 02:00:00 EST 2016 * Workers persist unless shutdown explicity while running alongside the Mojolicious framework. @@ -60,91 +60,91 @@ "provides" : { "MCE" : { "file" : "lib/MCE.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Candy" : { "file" : "lib/MCE/Candy.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Core::Input::Generator" : { "file" : "lib/MCE/Core/Input/Generator.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Core::Input::Handle" : { "file" : "lib/MCE/Core/Input/Handle.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Core::Input::Iterator" : { "file" : "lib/MCE/Core/Input/Iterator.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Core::Input::Request" : { "file" : "lib/MCE/Core/Input/Request.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Core::Input::Sequence" : { "file" : "lib/MCE/Core/Input/Sequence.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Core::Manager" : { "file" : "lib/MCE/Core/Manager.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Core::Validation" : { "file" : "lib/MCE/Core/Validation.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Core::Worker" : { "file" : "lib/MCE/Core/Worker.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Flow" : { "file" : "lib/MCE/Flow.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Grep" : { "file" : "lib/MCE/Grep.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Loop" : { "file" : "lib/MCE/Loop.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Map" : { "file" : "lib/MCE/Map.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Mutex" : { "file" : "lib/MCE/Mutex.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Queue" : { "file" : "lib/MCE/Queue.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Relay" : { "file" : "lib/MCE/Relay.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Signal" : { "file" : "lib/MCE/Signal.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Step" : { "file" : "lib/MCE/Step.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Stream" : { "file" : "lib/MCE/Stream.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Subs" : { "file" : "lib/MCE/Subs.pm", - "version" : "1.808" + "version" : "1.809" }, "MCE::Util" : { "file" : "lib/MCE/Util.pm", - "version" : "1.808" + "version" : "1.809" } }, "release_status" : "stable", @@ -160,5 +160,5 @@ "url" : "https://github.com/marioroy/mce-perl.git" } }, - "version" : "1.808" + "version" : "1.809" } @@ -25,70 +25,70 @@ no_index: provides: MCE: file: lib/MCE.pm - version: '1.808' + version: '1.809' MCE::Candy: file: lib/MCE/Candy.pm - version: '1.808' + version: '1.809' MCE::Core::Input::Generator: file: lib/MCE/Core/Input/Generator.pm - version: '1.808' + version: '1.809' MCE::Core::Input::Handle: file: lib/MCE/Core/Input/Handle.pm - version: '1.808' + version: '1.809' MCE::Core::Input::Iterator: file: lib/MCE/Core/Input/Iterator.pm - version: '1.808' + version: '1.809' MCE::Core::Input::Request: file: lib/MCE/Core/Input/Request.pm - version: '1.808' + version: '1.809' MCE::Core::Input::Sequence: file: lib/MCE/Core/Input/Sequence.pm - version: '1.808' + version: '1.809' MCE::Core::Manager: file: lib/MCE/Core/Manager.pm - version: '1.808' + version: '1.809' MCE::Core::Validation: file: lib/MCE/Core/Validation.pm - version: '1.808' + version: '1.809' MCE::Core::Worker: file: lib/MCE/Core/Worker.pm - version: '1.808' + version: '1.809' MCE::Flow: file: lib/MCE/Flow.pm - version: '1.808' + version: '1.809' MCE::Grep: file: lib/MCE/Grep.pm - version: '1.808' + version: '1.809' MCE::Loop: file: lib/MCE/Loop.pm - version: '1.808' + version: '1.809' MCE::Map: file: lib/MCE/Map.pm - version: '1.808' + version: '1.809' MCE::Mutex: file: lib/MCE/Mutex.pm - version: '1.808' + version: '1.809' MCE::Queue: file: lib/MCE/Queue.pm - version: '1.808' + version: '1.809' MCE::Relay: file: lib/MCE/Relay.pm - version: '1.808' + version: '1.809' MCE::Signal: file: lib/MCE/Signal.pm - version: '1.808' + version: '1.809' MCE::Step: file: lib/MCE/Step.pm - version: '1.808' + version: '1.809' MCE::Stream: file: lib/MCE/Stream.pm - version: '1.808' + version: '1.809' MCE::Subs: file: lib/MCE/Subs.pm - version: '1.808' + version: '1.809' MCE::Util: file: lib/MCE/Util.pm - version: '1.808' + version: '1.809' requires: Carp: '0' Fcntl: '0' @@ -111,4 +111,4 @@ resources: homepage: https://github.com/marioroy/mce-perl license: http://dev.perl.org/licenses/ repository: https://github.com/marioroy/mce-perl.git -version: '1.808' +version: '1.809' diff --git a/Makefile.PL b/Makefile.PL index a31313f..8e11da0 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -17,7 +17,7 @@ WriteMakefile( ABSTRACT => 'Many-Core Engine for Perl providing parallel processing capabilities', AUTHOR => 'Mario E. Roy <marioeroy AT gmail DOT com>', NAME => 'MCE', - VERSION => '1.808', + VERSION => '1.809', EXE_FILES => [ @exe_files ], @@ -67,91 +67,91 @@ WriteMakefile( 'provides' => { 'MCE' => { 'file' => 'lib/MCE.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Candy' => { 'file' => 'lib/MCE/Candy.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Core::Input::Generator' => { 'file' => 'lib/MCE/Core/Input/Generator.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Core::Input::Handle' => { 'file' => 'lib/MCE/Core/Input/Handle.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Core::Input::Iterator' => { 'file' => 'lib/MCE/Core/Input/Iterator.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Core::Input::Request' => { 'file' => 'lib/MCE/Core/Input/Request.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Core::Input::Sequence' => { 'file' => 'lib/MCE/Core/Input/Sequence.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Core::Manager' => { 'file' => 'lib/MCE/Core/Manager.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Core::Validation' => { 'file' => 'lib/MCE/Core/Validation.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Core::Worker' => { 'file' => 'lib/MCE/Core/Worker.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Flow' => { 'file' => 'lib/MCE/Flow.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Grep' => { 'file' => 'lib/MCE/Grep.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Loop' => { 'file' => 'lib/MCE/Loop.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Map' => { 'file' => 'lib/MCE/Map.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Mutex' => { 'file' => 'lib/MCE/Mutex.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Queue' => { 'file' => 'lib/MCE/Queue.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Relay' => { 'file' => 'lib/MCE/Relay.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Signal' => { 'file' => 'lib/MCE/Signal.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Step' => { 'file' => 'lib/MCE/Step.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Stream' => { 'file' => 'lib/MCE/Stream.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Subs' => { 'file' => 'lib/MCE/Subs.pm', - 'version' => '1.808' + 'version' => '1.809' }, 'MCE::Util' => { 'file' => 'lib/MCE/Util.pm', - 'version' => '1.808' + 'version' => '1.809' } } } ) : () ), @@ -1,6 +1,6 @@ ## Many-Core Engine for Perl -This document describes MCE version 1.808. +This document describes MCE version 1.809. Many-Core Engine (MCE) for Perl helps enable a new level of performance by maximizing all available cores. @@ -11,7 +11,7 @@ use warnings; no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (Subroutines::ProhibitSubroutinePrototypes) @@ -86,7 +86,7 @@ BEGIN { ## _chunk_id _mce_sid _mce_tid _pids _run_mode _single_dim _thrs _tids _wid ## _exiting _exit_pid _total_exited _total_running _total_workers _task_wid ## _send_cnt _sess_dir _spawned _state _status _task _task_id _wrk_status - ## _init_pid _init_total_workers _last_sref _mgr_live _rla_data + ## _init_pid _init_total_workers _last_sref _mgr_live _rla_data _seed ## ## _bsb_r_sock _bsb_w_sock _bse_r_sock _bse_w_sock _com_r_sock _com_w_sock ## _dat_r_sock _dat_w_sock _que_r_sock _que_w_sock _rla_r_sock _rla_w_sock @@ -393,8 +393,9 @@ sub new { } if (!exists $self{posix_exit}) { + $self{posix_exit} = 1 if ($_has_threads && $_tid); $self{posix_exit} = 1 if ($INC{'CGI.pm'} || $INC{'FCGI.pm'}); - $self{posix_exit} = 1 if ($INC{'Tk.pm'}); + $self{posix_exit} = 1 if ($INC{'Mojo/IOLoop.pm'} || $INC{'Tk.pm'}); } $self{flush_file} ||= 0; @@ -609,6 +610,8 @@ sub spawn { for (0 .. $_max_workers - 1); } + $self->{_seed} = int(rand() * 1e9); + ## ------------------------------------------------------------------------- ## Spawn workers. @@ -1090,12 +1093,14 @@ sub run { $self->shutdown(); } elsif ($^S || $ENV{'PERL_IPERL_RUNNING'}) { - if (!$INC{'Mojo/Base.pm'} && !$INC{'Tk.pm'}) { + if (!$INC{'Mojo/IOLoop.pm'} && !$INC{'Tk.pm'}) { # running inside eval or IPerl, check stack trace my $_t = Carp::longmess(); $_t =~ s/\teval [^\n]+\n$//; if ( $_t =~ /^(?:[^\n]+\n){1,7}\teval / || - $_t =~ /\n\teval [^\n]+\n\t(?:eval|Try)/ ) + $_t =~ /\n\teval [^\n]+\n\t(?:eval|Try)/ || + $_t =~ /\n\tMCE::_dispatch\(\) [^\n]+ thread \d+\n$/ || + ( $_tid && !$self->{use_threads} ) ) { $self->shutdown(); } @@ -1224,13 +1229,13 @@ sub shutdown { if (@{ $self->{_pids} } > 0) { my $_list = $self->{_pids}; for my $i (0 .. @{ $_list }) { - waitpid $_list->[$i], 0 if ($_list->[$i]); + waitpid($_list->[$i], 0) if $_list->[$i]; } } if (@{ $self->{_thrs} } > 0) { my $_list = $self->{_thrs}; for my $i (0 .. @{ $_list }) { - ${ $_list->[$i] }->join() if ($_list->[$i]); + $_list->[$i]->join() if $_list->[$i]; } } @@ -1499,6 +1504,7 @@ sub status { sub do { my $self = shift; $self = $MCE unless ref($self); + my $_pkg = caller() eq 'MCE' ? caller(1) : caller(); _croak('MCE::do: method is not allowed by the manager process') unless ($self->{_wid}); @@ -1510,7 +1516,7 @@ sub do { _croak('MCE::do: (callback) is not specified') unless (defined ( my $_func = shift )); - $_func = "main::$_func" if (index($_func, ':') < 0); + $_func = $_pkg.'::'.$_func if (index($_func, ':') < 0); return _do_callback($self, $_func, [ @_ ]); } @@ -1793,6 +1799,15 @@ sub _dispatch { $ENV{'PERL_MCE_IPC'} = 'win32' if ($_is_MSWin32 && $INC{'MCE/Hobo.pm'}); ## Sets the seed of the base generator uniquely between workers. + ## The new seed is computed using the current seed and $_wid value. + ## One may set the seed at the application level for predictable + ## results (non-thread workers only). Ditto for Math::Random. + + if (!$self->{use_threads}) { + my ($_wid, $_seed) = ($_args[1], $self->{_seed}); + srand(abs($_seed - ($_wid * 100000)) % 2147483560); + } + if ($INC{'Math/Random.pm'} && !$self->{use_threads}) { my ($_wid, $_cur_seed) = ($_args[1], Math::Random::random_get_seed()); @@ -1803,11 +1818,12 @@ sub _dispatch { Math::Random::random_set_seed($_new_seed, $_new_seed); } - ## Begin worker. + ## Run. + $self->{_pid} = ($_is_thread) ? $$ .'.'. threads->tid() : $$; + _worker_main(@_args, \@_plugin_worker_init); - ## Exit worker. _exit($self); } @@ -1827,13 +1843,13 @@ sub _dispatch_thread { ## Store into an available slot (restart), otherwise append to arrays. if (defined $_params) { for my $_i (0 .. @{ $self->{_tids} } - 1) { unless (defined $self->{_tids}->[$_i]) { - $self->{_thrs}->[$_i] = \$_thr; + $self->{_thrs}->[$_i] = $_thr; $self->{_tids}->[$_i] = $_thr->tid(); return; } }} - push @{ $self->{_thrs} }, \$_thr; + push @{ $self->{_thrs} }, $_thr; push @{ $self->{_tids} }, $_thr->tid(); if (defined $self->{spawn_delay} && $self->{spawn_delay} > 0.0) { diff --git a/lib/MCE.pod b/lib/MCE.pod index efe0384..9165172 100644 --- a/lib/MCE.pod +++ b/lib/MCE.pod @@ -5,7 +5,7 @@ MCE - Many-Core Engine for Perl providing parallel processing capabilities =head1 VERSION -This document describes MCE version 1.808 +This document describes MCE version 1.809 Many-Core Engine (MCE) for Perl helps enable a new level of performance by maximizing all available cores. diff --git a/lib/MCE/Candy.pm b/lib/MCE/Candy.pm index 12e1fc3..e3a2828 100644 --- a/lib/MCE/Candy.pm +++ b/lib/MCE/Candy.pm @@ -11,7 +11,7 @@ use warnings; no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.808'; +our $VERSION = '1.809'; our @CARP_NOT = qw( MCE ); @@ -210,7 +210,7 @@ MCE::Candy - Sugar methods and output iterators =head1 VERSION -This document describes MCE::Candy version 1.808 +This document describes MCE::Candy version 1.809 =head1 DESCRIPTION diff --git a/lib/MCE/Core.pod b/lib/MCE/Core.pod index a9d55b8..20182aa 100644 --- a/lib/MCE/Core.pod +++ b/lib/MCE/Core.pod @@ -5,7 +5,7 @@ MCE::Core - Documentation describing the core MCE API =head1 VERSION -This document describes MCE::Core version 1.808 +This document describes MCE::Core version 1.809 =head1 SYNOPSIS diff --git a/lib/MCE/Core/Input/Generator.pm b/lib/MCE/Core/Input/Generator.pm index 7d82fa3..530d05c 100644 --- a/lib/MCE/Core/Input/Generator.pm +++ b/lib/MCE/Core/Input/Generator.pm @@ -15,7 +15,7 @@ package MCE::Core::Input::Generator; use strict; use warnings; -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## Items below are folded into MCE. diff --git a/lib/MCE/Core/Input/Handle.pm b/lib/MCE/Core/Input/Handle.pm index 7212b7b..47ff736 100644 --- a/lib/MCE/Core/Input/Handle.pm +++ b/lib/MCE/Core/Input/Handle.pm @@ -14,7 +14,7 @@ package MCE::Core::Input::Handle; use strict; use warnings; -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## Items below are folded into MCE. diff --git a/lib/MCE/Core/Input/Iterator.pm b/lib/MCE/Core/Input/Iterator.pm index a32dd22..4534993 100644 --- a/lib/MCE/Core/Input/Iterator.pm +++ b/lib/MCE/Core/Input/Iterator.pm @@ -14,7 +14,7 @@ package MCE::Core::Input::Iterator; use strict; use warnings; -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## Items below are folded into MCE. diff --git a/lib/MCE/Core/Input/Request.pm b/lib/MCE/Core/Input/Request.pm index 998b069..bf9bcd3 100644 --- a/lib/MCE/Core/Input/Request.pm +++ b/lib/MCE/Core/Input/Request.pm @@ -14,7 +14,7 @@ package MCE::Core::Input::Request; use strict; use warnings; -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## Items below are folded into MCE. diff --git a/lib/MCE/Core/Input/Sequence.pm b/lib/MCE/Core/Input/Sequence.pm index fc7d4bc..9e5a14e 100644 --- a/lib/MCE/Core/Input/Sequence.pm +++ b/lib/MCE/Core/Input/Sequence.pm @@ -14,7 +14,7 @@ package MCE::Core::Input::Sequence; use strict; use warnings; -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## Items below are folded into MCE. diff --git a/lib/MCE/Core/Manager.pm b/lib/MCE/Core/Manager.pm index 7d72daa..6aaa7e6 100644 --- a/lib/MCE/Core/Manager.pm +++ b/lib/MCE/Core/Manager.pm @@ -14,7 +14,7 @@ package MCE::Core::Manager; use strict; use warnings; -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (TestingAndDebugging::ProhibitNoStrict) @@ -214,7 +214,7 @@ sub _output_loop { my $_tid = $1; my $_list = $self->{_tids}; for my $i (0 .. @{ $_list }) { if ($_list->[$i] && $_list->[$i] == $_tid) { - ${ $self->{_thrs}->[$i] }->join(); + $self->{_thrs}->[$i]->join(); $self->{_thrs}->[$i] = undef; $self->{_tids}->[$i] = undef; last; diff --git a/lib/MCE/Core/Validation.pm b/lib/MCE/Core/Validation.pm index 3194e47..1e9b375 100644 --- a/lib/MCE/Core/Validation.pm +++ b/lib/MCE/Core/Validation.pm @@ -14,7 +14,7 @@ package MCE::Core::Validation; use strict; use warnings; -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## Items below are folded into MCE. diff --git a/lib/MCE/Core/Worker.pm b/lib/MCE/Core/Worker.pm index e08b4a3..ca52fd3 100644 --- a/lib/MCE/Core/Worker.pm +++ b/lib/MCE/Core/Worker.pm @@ -14,7 +14,7 @@ package MCE::Core::Worker; use strict; use warnings; -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## Items below are folded into MCE. @@ -296,9 +296,11 @@ use bytes; $_dat_un = sub { syswrite ( $_DAT_LOCK->{_w_sock}, '0' ) }; } - local ($|, $!, $@); - - eval { select STDERR; $| = 1; select STDOUT; $| = 1 }; + { + local ($|, $!); + select(( select(*STDERR), $| = 1 )[0]) if defined(fileno *STDERR); + select(( select(*STDOUT), $| = 1 )[0]) if defined(fileno *STDOUT); + } return; } diff --git a/lib/MCE/Examples.pod b/lib/MCE/Examples.pod index ede4e60..d475345 100644 --- a/lib/MCE/Examples.pod +++ b/lib/MCE/Examples.pod @@ -5,7 +5,7 @@ MCE::Examples - Various examples and demonstrations =head1 VERSION -This document describes MCE::Examples version 1.808 +This document describes MCE::Examples version 1.809 =head1 INCLUDED WITH THE DISTRIBUTION diff --git a/lib/MCE/Flow.pm b/lib/MCE/Flow.pm index 2859dd5..f67377b 100644 --- a/lib/MCE/Flow.pm +++ b/lib/MCE/Flow.pm @@ -11,7 +11,7 @@ use warnings; no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (Subroutines::ProhibitSubroutinePrototypes) @@ -495,7 +495,7 @@ MCE::Flow - Parallel flow model for building creative applications =head1 VERSION -This document describes MCE::Flow version 1.808 +This document describes MCE::Flow version 1.809 =head1 DESCRIPTION diff --git a/lib/MCE/Grep.pm b/lib/MCE/Grep.pm index 245a8ad..7ee7d77 100644 --- a/lib/MCE/Grep.pm +++ b/lib/MCE/Grep.pm @@ -11,7 +11,7 @@ use warnings; no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (Subroutines::ProhibitSubroutinePrototypes) @@ -445,7 +445,7 @@ MCE::Grep - Parallel grep model similar to the native grep function =head1 VERSION -This document describes MCE::Grep version 1.808 +This document describes MCE::Grep version 1.809 =head1 SYNOPSIS diff --git a/lib/MCE/Loop.pm b/lib/MCE/Loop.pm index 680efb5..757a0ec 100644 --- a/lib/MCE/Loop.pm +++ b/lib/MCE/Loop.pm @@ -11,7 +11,7 @@ use warnings; no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (Subroutines::ProhibitSubroutinePrototypes) @@ -365,7 +365,7 @@ MCE::Loop - Parallel loop model for building creative loops =head1 VERSION -This document describes MCE::Loop version 1.808 +This document describes MCE::Loop version 1.809 =head1 DESCRIPTION diff --git a/lib/MCE/Map.pm b/lib/MCE/Map.pm index 54bd082..1e19a9f 100644 --- a/lib/MCE/Map.pm +++ b/lib/MCE/Map.pm @@ -11,7 +11,7 @@ use warnings; no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (Subroutines::ProhibitSubroutinePrototypes) @@ -445,7 +445,7 @@ MCE::Map - Parallel map model similar to the native map function =head1 VERSION -This document describes MCE::Map version 1.808 +This document describes MCE::Map version 1.809 =head1 SYNOPSIS diff --git a/lib/MCE/Mutex.pm b/lib/MCE/Mutex.pm index 1777484..ddf3dc3 100644 --- a/lib/MCE/Mutex.pm +++ b/lib/MCE/Mutex.pm @@ -11,7 +11,7 @@ use warnings; no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.808'; +our $VERSION = '1.809'; use MCE::Util qw( $LF ); @@ -111,7 +111,7 @@ MCE::Mutex - Locking for Many-Core Engine =head1 VERSION -This document describes MCE::Mutex version 1.808 +This document describes MCE::Mutex version 1.809 =head1 SYNOPSIS diff --git a/lib/MCE/Queue.pm b/lib/MCE/Queue.pm index 14d7d64..157673f 100644 --- a/lib/MCE/Queue.pm +++ b/lib/MCE/Queue.pm @@ -11,7 +11,7 @@ use warnings; no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## no critic (Subroutines::ProhibitExplicitReturnUndef) ## no critic (TestingAndDebugging::ProhibitNoStrict) @@ -1637,7 +1637,7 @@ MCE::Queue - Hybrid (normal and priority) queues =head1 VERSION -This document describes MCE::Queue version 1.808 +This document describes MCE::Queue version 1.809 =head1 SYNOPSIS diff --git a/lib/MCE/Relay.pm b/lib/MCE/Relay.pm index d86a258..44a2198 100644 --- a/lib/MCE/Relay.pm +++ b/lib/MCE/Relay.pm @@ -11,7 +11,7 @@ use warnings; no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## no critic (Subroutines::ProhibitSubroutinePrototypes) @@ -343,7 +343,7 @@ MCE::Relay - Extends Many-Core Engine with relay capabilities =head1 VERSION -This document describes MCE::Relay version 1.808 +This document describes MCE::Relay version 1.809 =head1 SYNOPSIS diff --git a/lib/MCE/Signal.pm b/lib/MCE/Signal.pm index 5a5ed3b..4616b54 100644 --- a/lib/MCE/Signal.pm +++ b/lib/MCE/Signal.pm @@ -11,7 +11,7 @@ use warnings; no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## no critic (BuiltinFunctions::ProhibitStringyEval) @@ -451,7 +451,7 @@ MCE::Signal - Temporary directory creation/cleanup and signal handling =head1 VERSION -This document describes MCE::Signal version 1.808 +This document describes MCE::Signal version 1.809 =head1 SYNOPSIS diff --git a/lib/MCE/Step.pm b/lib/MCE/Step.pm index 06a0663..ca98a4e 100644 --- a/lib/MCE/Step.pm +++ b/lib/MCE/Step.pm @@ -11,7 +11,7 @@ use warnings; no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (Subroutines::ProhibitSubroutinePrototypes) @@ -620,10 +620,11 @@ sub run (@) { MCE::_restore_state(); + # auto-shutdown if in eval state if ($^S || $ENV{'PERL_IPERL_RUNNING'}) { - if (!$INC{'Mojo/Base.pm'} && !$INC{'Tk.pm'}) { - $_MCE->{$_pid}->shutdown(); # shutdown if in eval state - $_->DESTROY() for (@{ $_queue->{$_pid} }); + if (!$INC{'Mojo/IOLoop.pm'} && !$INC{'Tk.pm'}) { + $_MCE->{$_pid}->shutdown(); + $_->DESTROY() for @{ $_queue->{$_pid} }; delete $_queue->{$_pid}; } } @@ -732,7 +733,7 @@ MCE::Step - Parallel step model for building creative steps =head1 VERSION -This document describes MCE::Step version 1.808 +This document describes MCE::Step version 1.809 =head1 DESCRIPTION diff --git a/lib/MCE/Stream.pm b/lib/MCE/Stream.pm index 90cd48e..23a5800 100644 --- a/lib/MCE/Stream.pm +++ b/lib/MCE/Stream.pm @@ -11,7 +11,7 @@ use warnings; no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (Subroutines::ProhibitSubroutinePrototypes) @@ -520,10 +520,11 @@ sub run (@) { MCE::_restore_state(); + # auto-shutdown if in eval state if ($^S || $ENV{'PERL_IPERL_RUNNING'}) { - if (!$INC{'Mojo/Base.pm'} && !$INC{'Tk.pm'}) { - $_MCE->{$_pid}->shutdown(); # shutdown if in eval state - $_->DESTROY() for (@{ $_queue->{$_pid} }); + if (!$INC{'Mojo/IOLoop.pm'} && !$INC{'Tk.pm'}) { + $_MCE->{$_pid}->shutdown(); + $_->DESTROY() for @{ $_queue->{$_pid} }; delete $_queue->{$_pid}; } } @@ -681,7 +682,7 @@ MCE::Stream - Parallel stream model for chaining multiple maps and greps =head1 VERSION -This document describes MCE::Stream version 1.808 +This document describes MCE::Stream version 1.809 =head1 SYNOPSIS diff --git a/lib/MCE/Subs.pm b/lib/MCE/Subs.pm index b4e91b4..5ee31dc 100644 --- a/lib/MCE/Subs.pm +++ b/lib/MCE/Subs.pm @@ -11,7 +11,7 @@ use warnings; no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## no critic (Subroutines::ProhibitSubroutinePrototypes) ## no critic (TestingAndDebugging::ProhibitNoStrict) @@ -204,7 +204,7 @@ MCE::Subs - Exports functions mapped directly to MCE methods =head1 VERSION -This document describes MCE::Subs version 1.808 +This document describes MCE::Subs version 1.809 =head1 SYNOPSIS diff --git a/lib/MCE/Util.pm b/lib/MCE/Util.pm index 974054e..011df90 100644 --- a/lib/MCE/Util.pm +++ b/lib/MCE/Util.pm @@ -11,7 +11,7 @@ use warnings; no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.808'; +our $VERSION = '1.809'; ## no critic (BuiltinFunctions::ProhibitStringyEval) @@ -203,15 +203,13 @@ sub _pipe_pair { or die "pipe: $!\n"; # IO::Handle->autoflush not available in older Perl. - select(( select($_obj->{$_r_sock}[$_i]), $| = 1 )[0]); select(( select($_obj->{$_w_sock}[$_i]), $| = 1 )[0]); } else { pipe($_obj->{$_r_sock}, $_obj->{$_w_sock}) or die "pipe: $!\n"; - select(( select($_obj->{$_r_sock}), $| = 1 )[0]); # Ditto. - select(( select($_obj->{$_w_sock}), $| = 1 )[0]); + select(( select($_obj->{$_w_sock}), $| = 1 )[0]); # Ditto. } return; @@ -236,8 +234,8 @@ sub _sock_pair { } # IO::Handle->autoflush not available in older Perl. - select(( select($_obj->{$_r_sock}[$_i]), $| = 1 )[0]); select(( select($_obj->{$_w_sock}[$_i]), $| = 1 )[0]); + select(( select($_obj->{$_r_sock}[$_i]), $| = 1 )[0]); } else { socketpair( $_obj->{$_r_sock}, $_obj->{$_w_sock}, @@ -250,8 +248,8 @@ sub _sock_pair { setsockopt($_obj->{$_w_sock}, SOL_SOCKET, SO_RCVBUF, int $_size); } - select(( select($_obj->{$_r_sock}), $| = 1 )[0]); # Ditto. - select(( select($_obj->{$_w_sock}), $| = 1 )[0]); + select(( select($_obj->{$_w_sock}), $| = 1 )[0]); # Ditto. + select(( select($_obj->{$_r_sock}), $| = 1 )[0]); } return; @@ -428,7 +426,7 @@ MCE::Util - Utility functions =head1 VERSION -This document describes MCE::Util version 1.808 +This document describes MCE::Util version 1.809 =head1 SYNOPSIS |