Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package perl-MCE for openSUSE:Factory checked in at 2021-12-06 23:59:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-MCE (Old) and /work/SRC/openSUSE:Factory/.perl-MCE.new.31177 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-MCE" Mon Dec 6 23:59:51 2021 rev:22 rq:935936 version:1.876 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-MCE/perl-MCE.changes 2021-11-27 00:52:36.162537242 +0100 +++ /work/SRC/openSUSE:Factory/.perl-MCE.new.31177/perl-MCE.changes 2021-12-07 00:01:03.484208793 +0100 @@ -1,0 +2,16 @@ +Fri Dec 3 03:07:14 UTC 2021 - Tina M??ller <[email protected]> + +- updated to 1.876 + see /usr/share/doc/packages/perl-MCE/Changes + + 1.876 Thu Dec 02 18:00:00 EST 2021 + + * Allow percentage above 100% for max_workers in MCE. + + * MCE::Child update. + Improved _ordhash. + Renamed JOINED to REAPED in code for better clarity. + Specify a percentage for max_workers. + Added t/05_mce_child_max_workers.t + +------------------------------------------------------------------- Old: ---- MCE-1.875.tar.gz New: ---- MCE-1.876.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-MCE.spec ++++++ --- /var/tmp/diff_new_pack.Z5AZRd/_old 2021-12-07 00:01:04.276205992 +0100 +++ /var/tmp/diff_new_pack.Z5AZRd/_new 2021-12-07 00:01:04.276205992 +0100 @@ -18,7 +18,7 @@ %define cpan_name MCE Name: perl-MCE -Version: 1.875 +Version: 1.876 Release: 0 Summary: Many-Core Engine for Perl providing parallel processing capabilities License: Artistic-1.0 OR GPL-1.0-or-later ++++++ MCE-1.875.tar.gz -> MCE-1.876.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/Changes new/MCE-1.876/Changes --- old/MCE-1.875/Changes 2021-11-16 10:11:54.000000000 +0100 +++ new/MCE-1.876/Changes 2021-12-03 00:05:21.000000000 +0100 @@ -1,6 +1,16 @@ Revision history for Perl module MCE. +1.876 Thu Dec 02 18:00:00 EST 2021 + + * Allow percentage above 100% for max_workers in MCE. + + * MCE::Child update. + Improved _ordhash. + Renamed JOINED to REAPED in code for better clarity. + Specify a percentage for max_workers. + Added t/05_mce_child_max_workers.t + 1.875 Tue Nov 16 04:00:00 EST 2021 * Specify a percentage for max_workers. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/MANIFEST new/MCE-1.876/MANIFEST --- old/MCE-1.875/MANIFEST 2021-11-16 10:09:57.000000000 +0100 +++ new/MCE-1.876/MANIFEST 2021-12-02 23:48:33.000000000 +0100 @@ -65,6 +65,7 @@ t/04_channel_threads.t t/04_channel_threads_mp.t t/05_mce_child.t +t/05_mce_child_max_workers.t t/05_mce_flow.t t/05_mce_grep.t t/05_mce_loop.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/META.json new/MCE-1.876/META.json --- old/MCE-1.875/META.json 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/META.json 2021-12-02 23:52:19.000000000 +0100 @@ -65,123 +65,123 @@ "provides" : { "MCE" : { "file" : "lib/MCE.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Candy" : { "file" : "lib/MCE/Candy.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Channel" : { "file" : "lib/MCE/Channel.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Channel::Mutex" : { "file" : "lib/MCE/Channel/Mutex.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Channel::Simple" : { "file" : "lib/MCE/Channel/Simple.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Channel::Threads" : { "file" : "lib/MCE/Channel/Threads.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Child" : { "file" : "lib/MCE/Child.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Core::Input::Generator" : { "file" : "lib/MCE/Core/Input/Generator.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Core::Input::Handle" : { "file" : "lib/MCE/Core/Input/Handle.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Core::Input::Iterator" : { "file" : "lib/MCE/Core/Input/Iterator.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Core::Input::Request" : { "file" : "lib/MCE/Core/Input/Request.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Core::Input::Sequence" : { "file" : "lib/MCE/Core/Input/Sequence.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Core::Manager" : { "file" : "lib/MCE/Core/Manager.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Core::Validation" : { "file" : "lib/MCE/Core/Validation.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Core::Worker" : { "file" : "lib/MCE/Core/Worker.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Flow" : { "file" : "lib/MCE/Flow.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Grep" : { "file" : "lib/MCE/Grep.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Loop" : { "file" : "lib/MCE/Loop.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Map" : { "file" : "lib/MCE/Map.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Mutex" : { "file" : "lib/MCE/Mutex.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Mutex::Channel" : { "file" : "lib/MCE/Mutex/Channel.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Mutex::Channel2" : { "file" : "lib/MCE/Mutex/Channel2.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Mutex::Flock" : { "file" : "lib/MCE/Mutex/Flock.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Queue" : { "file" : "lib/MCE/Queue.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Relay" : { "file" : "lib/MCE/Relay.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Signal" : { "file" : "lib/MCE/Signal.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Step" : { "file" : "lib/MCE/Step.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Stream" : { "file" : "lib/MCE/Stream.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Subs" : { "file" : "lib/MCE/Subs.pm", - "version" : "1.875" + "version" : "1.876" }, "MCE::Util" : { "file" : "lib/MCE/Util.pm", - "version" : "1.875" + "version" : "1.876" } }, "release_status" : "stable", @@ -197,5 +197,5 @@ "url" : "https://github.com/marioroy/mce-perl.git" } }, - "version" : "1.875" + "version" : "1.876" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/META.yml new/MCE-1.876/META.yml --- old/MCE-1.875/META.yml 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/META.yml 2021-12-02 23:52:19.000000000 +0100 @@ -25,94 +25,94 @@ provides: MCE: file: lib/MCE.pm - version: '1.875' + version: '1.876' MCE::Candy: file: lib/MCE/Candy.pm - version: '1.875' + version: '1.876' MCE::Channel: file: lib/MCE/Channel.pm - version: '1.875' + version: '1.876' MCE::Channel::Mutex: file: lib/MCE/Channel/Mutex.pm - version: '1.875' + version: '1.876' MCE::Channel::Simple: file: lib/MCE/Channel/Simple.pm - version: '1.875' + version: '1.876' MCE::Channel::Threads: file: lib/MCE/Channel/Threads.pm - version: '1.875' + version: '1.876' MCE::Child: file: lib/MCE/Child.pm - version: '1.875' + version: '1.876' MCE::Core::Input::Generator: file: lib/MCE/Core/Input/Generator.pm - version: '1.875' + version: '1.876' MCE::Core::Input::Handle: file: lib/MCE/Core/Input/Handle.pm - version: '1.875' + version: '1.876' MCE::Core::Input::Iterator: file: lib/MCE/Core/Input/Iterator.pm - version: '1.875' + version: '1.876' MCE::Core::Input::Request: file: lib/MCE/Core/Input/Request.pm - version: '1.875' + version: '1.876' MCE::Core::Input::Sequence: file: lib/MCE/Core/Input/Sequence.pm - version: '1.875' + version: '1.876' MCE::Core::Manager: file: lib/MCE/Core/Manager.pm - version: '1.875' + version: '1.876' MCE::Core::Validation: file: lib/MCE/Core/Validation.pm - version: '1.875' + version: '1.876' MCE::Core::Worker: file: lib/MCE/Core/Worker.pm - version: '1.875' + version: '1.876' MCE::Flow: file: lib/MCE/Flow.pm - version: '1.875' + version: '1.876' MCE::Grep: file: lib/MCE/Grep.pm - version: '1.875' + version: '1.876' MCE::Loop: file: lib/MCE/Loop.pm - version: '1.875' + version: '1.876' MCE::Map: file: lib/MCE/Map.pm - version: '1.875' + version: '1.876' MCE::Mutex: file: lib/MCE/Mutex.pm - version: '1.875' + version: '1.876' MCE::Mutex::Channel: file: lib/MCE/Mutex/Channel.pm - version: '1.875' + version: '1.876' MCE::Mutex::Channel2: file: lib/MCE/Mutex/Channel2.pm - version: '1.875' + version: '1.876' MCE::Mutex::Flock: file: lib/MCE/Mutex/Flock.pm - version: '1.875' + version: '1.876' MCE::Queue: file: lib/MCE/Queue.pm - version: '1.875' + version: '1.876' MCE::Relay: file: lib/MCE/Relay.pm - version: '1.875' + version: '1.876' MCE::Signal: file: lib/MCE/Signal.pm - version: '1.875' + version: '1.876' MCE::Step: file: lib/MCE/Step.pm - version: '1.875' + version: '1.876' MCE::Stream: file: lib/MCE/Stream.pm - version: '1.875' + version: '1.876' MCE::Subs: file: lib/MCE/Subs.pm - version: '1.875' + version: '1.876' MCE::Util: file: lib/MCE/Util.pm - version: '1.875' + version: '1.876' recommends: Sereal::Decoder: '3.015' Sereal::Encoder: '3.015' @@ -139,4 +139,4 @@ homepage: https://github.com/marioroy/mce-perl license: http://dev.perl.org/licenses/ repository: https://github.com/marioroy/mce-perl.git -version: '1.875' +version: '1.876' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/Makefile.PL new/MCE-1.876/Makefile.PL --- old/MCE-1.875/Makefile.PL 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/Makefile.PL 2021-12-02 23:52:19.000000000 +0100 @@ -17,7 +17,7 @@ ABSTRACT => 'Many-Core Engine for Perl providing parallel processing capabilities', AUTHOR => 'Mario E. Roy <marioeroy AT gmail DOT com>', NAME => 'MCE', - VERSION => '1.875', + VERSION => '1.876', EXE_FILES => [ @exe_files ], @@ -68,123 +68,123 @@ 'provides' => { 'MCE' => { 'file' => 'lib/MCE.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Candy' => { 'file' => 'lib/MCE/Candy.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Channel' => { 'file' => 'lib/MCE/Channel.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Channel::Mutex' => { 'file' => 'lib/MCE/Channel/Mutex.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Channel::Simple' => { 'file' => 'lib/MCE/Channel/Simple.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Channel::Threads' => { 'file' => 'lib/MCE/Channel/Threads.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Child' => { 'file' => 'lib/MCE/Child.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Core::Input::Generator' => { 'file' => 'lib/MCE/Core/Input/Generator.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Core::Input::Handle' => { 'file' => 'lib/MCE/Core/Input/Handle.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Core::Input::Iterator' => { 'file' => 'lib/MCE/Core/Input/Iterator.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Core::Input::Request' => { 'file' => 'lib/MCE/Core/Input/Request.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Core::Input::Sequence' => { 'file' => 'lib/MCE/Core/Input/Sequence.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Core::Manager' => { 'file' => 'lib/MCE/Core/Manager.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Core::Validation' => { 'file' => 'lib/MCE/Core/Validation.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Core::Worker' => { 'file' => 'lib/MCE/Core/Worker.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Flow' => { 'file' => 'lib/MCE/Flow.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Grep' => { 'file' => 'lib/MCE/Grep.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Loop' => { 'file' => 'lib/MCE/Loop.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Map' => { 'file' => 'lib/MCE/Map.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Mutex' => { 'file' => 'lib/MCE/Mutex.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Mutex::Channel' => { 'file' => 'lib/MCE/Mutex/Channel.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Mutex::Channel2' => { 'file' => 'lib/MCE/Mutex/Channel2.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Mutex::Flock' => { 'file' => 'lib/MCE/Mutex/Flock.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Queue' => { 'file' => 'lib/MCE/Queue.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Relay' => { 'file' => 'lib/MCE/Relay.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Signal' => { 'file' => 'lib/MCE/Signal.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Step' => { 'file' => 'lib/MCE/Step.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Stream' => { 'file' => 'lib/MCE/Stream.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Subs' => { 'file' => 'lib/MCE/Subs.pm', - 'version' => '1.875' + 'version' => '1.876' }, 'MCE::Util' => { 'file' => 'lib/MCE/Util.pm', - 'version' => '1.875' + 'version' => '1.876' } }, 'prereqs' => { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/README.md new/MCE-1.876/README.md --- old/MCE-1.875/README.md 2021-11-16 10:05:49.000000000 +0100 +++ new/MCE-1.876/README.md 2021-12-02 23:52:19.000000000 +0100 @@ -1,6 +1,6 @@ ## Many-Core Engine for Perl -This document describes MCE version 1.875. +This document describes MCE version 1.876. Many-Core Engine (MCE) for Perl helps enable a new level of performance by maximizing all available cores. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Candy.pm new/MCE-1.876/lib/MCE/Candy.pm --- old/MCE-1.875/lib/MCE/Candy.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Candy.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; our @CARP_NOT = qw( MCE ); @@ -240,7 +240,7 @@ =head1 VERSION -This document describes MCE::Candy version 1.875 +This document describes MCE::Candy version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Channel/Mutex.pm new/MCE-1.876/lib/MCE/Channel/Mutex.pm --- old/MCE-1.875/lib/MCE/Channel/Mutex.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Channel/Mutex.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( uninitialized once ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; use base 'MCE::Channel'; use MCE::Mutex (); @@ -304,7 +304,7 @@ =head1 VERSION -This document describes MCE::Channel::Mutex version 1.875 +This document describes MCE::Channel::Mutex version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Channel/Simple.pm new/MCE-1.876/lib/MCE/Channel/Simple.pm --- old/MCE-1.875/lib/MCE/Channel/Simple.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Channel/Simple.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( uninitialized once ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; use base 'MCE::Channel'; @@ -300,7 +300,7 @@ =head1 VERSION -This document describes MCE::Channel::Simple version 1.875 +This document describes MCE::Channel::Simple version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Channel/Threads.pm new/MCE-1.876/lib/MCE/Channel/Threads.pm --- old/MCE-1.875/lib/MCE/Channel/Threads.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Channel/Threads.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( uninitialized once ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; use threads; use threads::shared; @@ -320,7 +320,7 @@ =head1 VERSION -This document describes MCE::Channel::Threads version 1.875 +This document describes MCE::Channel::Threads version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Channel.pm new/MCE-1.876/lib/MCE/Channel.pm --- old/MCE-1.875/lib/MCE/Channel.pm 2021-11-16 10:05:55.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Channel.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( uninitialized once ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (TestingAndDebugging::ProhibitNoStrict) @@ -127,7 +127,7 @@ =head1 VERSION -This document describes MCE::Channel version 1.875 +This document describes MCE::Channel version 1.876 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Child.pm new/MCE-1.876/lib/MCE/Child.pm --- old/MCE-1.875/lib/MCE/Child.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Child.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ package MCE::Child; -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (Subroutines::ProhibitExplicitReturnUndef) @@ -56,6 +56,19 @@ %{ $_LIST } = (); } +sub _max_workers { + my ( $cpus ) = @_; + if ( $cpus eq 'auto' ) { + $cpus = MCE::Util::get_ncpu(); + } + elsif ( $cpus =~ /^([0-9.]+)%$/ ) { + my ( $percent, $ncpu ) = ( $1 / 100, MCE::Util::get_ncpu() ); + $cpus = $ncpu * $percent + 0.5; + } + $cpus = 1 if $cpus !~ /^[\d\.]+$/ || $cpus < 1; + return int($cpus); +} + ############################################################################### ## ---------------------------------------------------------------------------- ## Init routine. @@ -79,7 +92,7 @@ $mngd->{MGR_ID} = "$$.$_tid", $mngd->{PKG} = $pkg, $mngd->{WRK_ID} = $$; - &_force_reap($pkg), $_DATA->{$pkg}->clear() if exists $_LIST->{$pkg}; + &_force_reap($pkg), $_DATA->{$pkg}->clear() if ( exists $_LIST->{$pkg} ); if ( !exists $_LIST->{$pkg} ) { $MCE::_GMUTEX->lock() if ( $_tid && $MCE::_GMUTEX ); @@ -108,11 +121,8 @@ ); } - if ( $mngd->{max_workers} ) { - my $cpus = $mngd->{max_workers}; - $cpus = MCE::Util::get_ncpu() if $cpus eq 'auto'; - $cpus = 1 if $cpus !~ /^[\d\.]+$/ || $cpus < 1; - $mngd->{max_workers} = int($cpus); + if ( defined $mngd->{max_workers} ) { + $mngd->{max_workers} = _max_workers($mngd->{max_workers}); } if ( $INC{'LWP/UserAgent.pm'} && !$INC{'Net/HTTP.pm'} ) { @@ -173,20 +183,21 @@ $_DATA->{"$pkg:id"} = 10000 if ( ( my $id = ++$_DATA->{"$pkg:id"} ) > 2e9 ); if ( $max_workers || $self->{IGNORE} ) { - local $!; + my $wrk_id; local $!; # Reap completed child processes. $_DATA->{$pkg}->reap_data; - for my $wrk_id ( keys %{ $list->[0] } ) { - $list->del($wrk_id), next if ( exists $list->[0]{$wrk_id}{JOINED} ); + for my $child ( $list->vals() ) { + $wrk_id = $child->{WRK_ID}; + $list->del($wrk_id), next if $child->{REAPED}; waitpid($wrk_id, _WNOHANG) or next; _reap_child($list->del($wrk_id), 0); } # Wait for a slot if saturated. - if ( $max_workers && keys(%{ $list->[0] }) >= $max_workers ) { - my $count = keys(%{ $list->[0] }) - $max_workers + 1; + if ( $max_workers && $list->len() >= $max_workers ) { + my $count = $list->len() - $max_workers + 1; _wait_one($pkg) for 1 .. $count; } } @@ -283,7 +294,7 @@ sub error { _croak('Usage: $child->error()') unless ref( my $self = $_[0] ); - $self->join() unless ( exists $self->{JOINED} ); + $self->join() unless $self->{REAPED}; $self->{ERROR} || undef; } @@ -303,7 +314,7 @@ _exit($?); # not reached } - return $self if ( exists $self->{JOINED} ); + return $self if $self->{REAPED}; if ( exists $_DATA->{$pkg} ) { sleep 0.015 until $_DATA->{$pkg}->exists('S'.$wrk_id); @@ -353,10 +364,10 @@ ''; } elsif ( $self->{MGR_ID} eq "$$.$_tid" ) { - return '' if ( exists $self->{JOINED} ); + return '' if $self->{REAPED}; local $!; $_DATA->{$pkg}->reap_data; ( waitpid($wrk_id, _WNOHANG) == 0 ) ? '' : do { - _reap_child($self, 0) unless ( exists $self->{JOINED} ); + _reap_child($self, 0) unless $self->{REAPED}; 1; }; } @@ -374,10 +385,10 @@ 1; } elsif ( $self->{MGR_ID} eq "$$.$_tid" ) { - return '' if ( exists $self->{JOINED} ); + return '' if $self->{REAPED}; local $!; $_DATA->{$pkg}->reap_data; ( waitpid($wrk_id, _WNOHANG) == 0 ) ? 1 : do { - _reap_child($self, 0) unless ( exists $self->{JOINED} ); + _reap_child($self, 0) unless $self->{REAPED}; ''; }; } @@ -391,9 +402,9 @@ _croak('Usage: $child->join()') unless ref( my $self = $_[0] ); my ( $wrk_id, $pkg ) = ( $self->{WRK_ID}, $self->{PKG} ); - if ( exists $self->{JOINED} ) { + if ( $self->{REAPED} ) { _croak('Child already joined') unless exists( $self->{RESULT} ); - $_LIST->{$pkg}->del($wrk_id) if exists( $_LIST->{$pkg} ); + $_LIST->{$pkg}->del($wrk_id) if ( exists $_LIST->{$pkg} ); return ( defined wantarray ) ? wantarray ? @{ delete $self->{RESULT} } : delete( $self->{RESULT} )->[-1] @@ -430,7 +441,7 @@ return $self; } if ( $self->{MGR_ID} eq "$$.$_tid" ) { - return $self if ( exists $self->{JOINED} ); + return $self if $self->{REAPED}; if ( exists $_DATA->{$pkg} ) { sleep 0.015 until $_DATA->{$pkg}->exists('S'.$wrk_id); } else { @@ -468,7 +479,7 @@ map { ( waitpid($_->{WRK_ID}, _WNOHANG) == 0 ) ? () : do { - _reap_child($_, 0) unless ( exists $_->{JOINED} ); + _reap_child($_, 0) unless $_->{REAPED}; $_; }; } @@ -486,7 +497,7 @@ map { ( waitpid($_->{WRK_ID}, _WNOHANG) == 0 ) ? $_ : do { - _reap_child($_, 0) unless ( exists $_->{JOINED} ); + _reap_child($_, 0) unless $_->{REAPED}; (); }; } @@ -501,16 +512,7 @@ }; shift if ( $_[0] eq __PACKAGE__ ); - if ( @_ ) { - $mngd->{max_workers} = shift; - if ( $mngd->{max_workers} ) { - my $cpus = $mngd->{max_workers}; - $cpus = MCE::Util::get_ncpu() if $cpus eq 'auto'; - $cpus = 1 if $cpus !~ /^[\d\.]+$/ || $cpus < 1; - $mngd->{max_workers} = int($cpus); - } - } - + $mngd->{max_workers} = _max_workers(shift) if @_; $mngd->{max_workers}; } @@ -527,7 +529,7 @@ sub result { _croak('Usage: $child->result()') unless ref( my $self = $_[0] ); - return $self->join() unless ( exists $self->{JOINED} ); + return $self->join() unless $self->{REAPED}; _croak('Child already joined') unless exists( $self->{RESULT} ); wantarray ? @{ delete $self->{RESULT} } : delete( $self->{RESULT} )->[-1]; @@ -722,7 +724,7 @@ local @_ = $_DATA->{ $child->{PKG} }->get( $child->{WRK_ID}, $wait_flag ); - ( $child->{ERROR}, $child->{RESULT}, $child->{JOINED} ) = + ( $child->{ERROR}, $child->{RESULT}, $child->{REAPED} ) = ( pop || '', length $_[0] ? pop : [], 1 ); return if $child->{IGNORE}; @@ -771,9 +773,9 @@ while () { $_DATA->{$pkg}->reap_data; - for my $child ( $list->vals ) { + for my $child ( $list->vals() ) { $wrk_id = $child->{WRK_ID}; - return $list->del($wrk_id) if ( exists $child->{JOINED} ); + return $list->del($wrk_id) if $child->{REAPED}; $self = $list->del($wrk_id), last if waitpid($wrk_id, _WNOHANG); } last if $self; @@ -919,49 +921,51 @@ package # hide from rpm MCE::Child::_ordhash; -sub new { my $gcnt = 0; bless [ {}, [], {}, \$gcnt ], shift; } +sub new { bless [ {}, [], {}, 0 ], shift; } # data, keys, indx, gcnt sub exists { CORE::exists $_[0]->[0]{ $_[1] }; } sub get { $_[0]->[0]{ $_[1] }; } sub len { scalar keys %{ $_[0]->[0] }; } sub clear { - %{ $_[0]->[0] } = @{ $_[0]->[1] } = %{ $_[0]->[2] } = (); - ${ $_[0]->[3] } = 0; + my ( $self ) = @_; + %{ $self->[0] } = @{ $self->[1] } = %{ $self->[2] } = (), $self->[3] = 0; return; } sub del { - my ( $data, $keys, $indx, $gcnt ) = @{ $_[0] }; - my $pos = delete $indx->{ $_[1] }; - return undef unless ( defined $pos ); + my ( $self, $key ) = @_; + return undef unless defined( my $off = delete $self->[2]{$key} ); - $keys->[ $pos ] = undef; + # tombstone + $self->[1][$off] = undef; - if ( ++${ $gcnt } > @{ $keys } * 0.667 ) { - my $i; $i = ${ $gcnt } = 0; + # GC keys and refresh index + if ( ++$self->[3] > @{ $self->[1] } * 0.667 ) { + my ( $keys, $indx ) = ( $self->[1], $self->[2] ); + my $i; $i = $self->[3] = 0; for my $k ( @{ $keys } ) { - $keys->[ $i ] = $k, $indx->{ $k } = $i++ if ( defined $k ); + $keys->[$i] = $k, $indx->{$k} = $i++ if defined($k); } splice @{ $keys }, $i; } - delete $data->{ $_[1] }; + delete $self->[0]{$key}; } sub set { - my ( $key, $data, $keys, $indx ) = ( $_[1], @{ $_[0] } ); + my ( $self, $key ) = @_; + $self->[0]{$key} = $_[2], return 1 if exists($self->[0]{$key}); - $data->{ $key } = $_[2], $indx->{ $key } = @{ $keys }; - push @{ $keys }, "$key"; + $self->[2]{$key} = @{ $self->[1] }; push @{ $self->[1] }, $key; + $self->[0]{$key} = $_[2]; - return; + return 1; } sub vals { my ( $self ) = @_; - - ${ $self->[3] } + $self->[3] ? @{ $self->[0] }{ grep defined($_), @{ $self->[1] } } : @{ $self->[0] }{ @{ $self->[1] } }; } @@ -982,7 +986,7 @@ =head1 VERSION -This document describes MCE::Child version 1.875 +This document describes MCE::Child version 1.876 =head1 SYNOPSIS @@ -990,9 +994,15 @@ MCE::Child->init( max_workers => 'auto', # default undef, unlimited + + # Specify a percentage. MCE::Child 1.876+. + max_workers => '25%', # 4 on HW with 16 lcores + max_workers => '50%', # 8 on HW with 16 lcores + child_timeout => 20, # default undef, no timeout posix_exit => 1, # default undef, CORE::exit void_context => 1, # default undef + on_start => sub { my ( $pid, $ident ) = @_; ... @@ -1264,9 +1274,15 @@ MCE::Child->init( max_workers => 'auto', # default undef, unlimited + + # Specify a percentage. MCE::Child 1.876+. + max_workers => '25%', # 4 on HW with 16 lcores + max_workers => '50%', # 8 on HW with 16 lcores + child_timeout => 20, # default undef, no timeout posix_exit => 1, # default undef, CORE::exit void_context => 1, # default undef + on_start => sub { my ( $pid, $ident ) = @_; ... @@ -1287,8 +1303,8 @@ MCE::Child->wait_all; Set C<max_workers> if you want to limit the number of workers by waiting -automatically for an available slot. Specify C<auto> to obtain the number -of logical cores via C<MCE::Util::get_ncpu()>. +automatically for an available slot. Specify a percentage or C<auto> to +obtain the number of logical cores via C<MCE::Util::get_ncpu()>. Set C<child_timeout>, in number of seconds, if you want the child process to terminate after some time. The default is C<0> for no timeout. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Core/Input/Generator.pm new/MCE-1.876/lib/MCE/Core/Input/Generator.pm --- old/MCE-1.875/lib/MCE/Core/Input/Generator.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Core/Input/Generator.pm 2021-12-02 23:52:19.000000000 +0100 @@ -15,7 +15,7 @@ use strict; use warnings; -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## Items below are folded into MCE. @@ -220,7 +220,7 @@ =head1 VERSION -This document describes MCE::Core::Input::Generator version 1.875 +This document describes MCE::Core::Input::Generator version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Core/Input/Handle.pm new/MCE-1.876/lib/MCE/Core/Input/Handle.pm --- old/MCE-1.875/lib/MCE/Core/Input/Handle.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Core/Input/Handle.pm 2021-12-02 23:52:19.000000000 +0100 @@ -14,7 +14,7 @@ use strict; use warnings; -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## Items below are folded into MCE. @@ -280,7 +280,7 @@ =head1 VERSION -This document describes MCE::Core::Input::Handle version 1.875 +This document describes MCE::Core::Input::Handle version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Core/Input/Iterator.pm new/MCE-1.876/lib/MCE/Core/Input/Iterator.pm --- old/MCE-1.875/lib/MCE/Core/Input/Iterator.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Core/Input/Iterator.pm 2021-12-02 23:52:19.000000000 +0100 @@ -14,7 +14,7 @@ use strict; use warnings; -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## Items below are folded into MCE. @@ -128,7 +128,7 @@ =head1 VERSION -This document describes MCE::Core::Input::Iterator version 1.875 +This document describes MCE::Core::Input::Iterator version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Core/Input/Request.pm new/MCE-1.876/lib/MCE/Core/Input/Request.pm --- old/MCE-1.875/lib/MCE/Core/Input/Request.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Core/Input/Request.pm 2021-12-02 23:52:19.000000000 +0100 @@ -14,7 +14,7 @@ use strict; use warnings; -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## Items below are folded into MCE. @@ -199,7 +199,7 @@ =head1 VERSION -This document describes MCE::Core::Input::Request version 1.875 +This document describes MCE::Core::Input::Request version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Core/Input/Sequence.pm new/MCE-1.876/lib/MCE/Core/Input/Sequence.pm --- old/MCE-1.875/lib/MCE/Core/Input/Sequence.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Core/Input/Sequence.pm 2021-12-02 23:52:19.000000000 +0100 @@ -14,7 +14,7 @@ use strict; use warnings; -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## Items below are folded into MCE. @@ -231,7 +231,7 @@ =head1 VERSION -This document describes MCE::Core::Input::Sequence version 1.875 +This document describes MCE::Core::Input::Sequence version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Core/Manager.pm new/MCE-1.876/lib/MCE/Core/Manager.pm --- old/MCE-1.875/lib/MCE/Core/Manager.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Core/Manager.pm 2021-12-02 23:52:19.000000000 +0100 @@ -14,7 +14,7 @@ use strict; use warnings; -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (TestingAndDebugging::ProhibitNoStrict) @@ -1041,7 +1041,7 @@ =head1 VERSION -This document describes MCE::Core::Manager version 1.875 +This document describes MCE::Core::Manager version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Core/Validation.pm new/MCE-1.876/lib/MCE/Core/Validation.pm --- old/MCE-1.875/lib/MCE/Core/Validation.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Core/Validation.pm 2021-12-02 23:52:19.000000000 +0100 @@ -14,7 +14,7 @@ use strict; use warnings; -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## Items below are folded into MCE. @@ -362,7 +362,6 @@ $_max_workers = int($_ncpu * $_percent + 0.5); $_max_workers = 1 if ($_max_workers < 1); - $_max_workers = $_ncpu if ($_max_workers > $_ncpu); } return $_max_workers; @@ -399,7 +398,7 @@ =head1 VERSION -This document describes MCE::Core::Validation version 1.875 +This document describes MCE::Core::Validation version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Core/Worker.pm new/MCE-1.876/lib/MCE/Core/Worker.pm --- old/MCE-1.875/lib/MCE/Core/Worker.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Core/Worker.pm 2021-12-02 23:52:19.000000000 +0100 @@ -14,7 +14,7 @@ use strict; use warnings; -our $VERSION = '1.875'; +our $VERSION = '1.876'; my $_tid = $INC{'threads.pm'} ? threads->tid() : 0; @@ -714,7 +714,7 @@ =head1 VERSION -This document describes MCE::Core::Worker version 1.875 +This document describes MCE::Core::Worker version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Core.pod new/MCE-1.876/lib/MCE/Core.pod --- old/MCE-1.875/lib/MCE/Core.pod 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Core.pod 2021-12-02 23:52:19.000000000 +0100 @@ -5,7 +5,7 @@ =head1 VERSION -This document describes MCE::Core version 1.875 +This document describes MCE::Core version 1.876 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Examples.pod new/MCE-1.876/lib/MCE/Examples.pod --- old/MCE-1.875/lib/MCE/Examples.pod 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Examples.pod 2021-12-02 23:52:19.000000000 +0100 @@ -5,7 +5,7 @@ =head1 VERSION -This document describes MCE::Examples version 1.875 +This document describes MCE::Examples version 1.876 =head1 INCLUDED WITH THE DISTRIBUTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Flow.pm new/MCE-1.876/lib/MCE/Flow.pm --- old/MCE-1.875/lib/MCE/Flow.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Flow.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (Subroutines::ProhibitSubroutinePrototypes) @@ -479,7 +479,7 @@ =head1 VERSION -This document describes MCE::Flow version 1.875 +This document describes MCE::Flow version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Grep.pm new/MCE-1.876/lib/MCE/Grep.pm --- old/MCE-1.875/lib/MCE/Grep.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Grep.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (Subroutines::ProhibitSubroutinePrototypes) @@ -434,7 +434,7 @@ =head1 VERSION -This document describes MCE::Grep version 1.875 +This document describes MCE::Grep version 1.876 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Loop.pm new/MCE-1.876/lib/MCE/Loop.pm --- old/MCE-1.875/lib/MCE/Loop.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Loop.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (Subroutines::ProhibitSubroutinePrototypes) @@ -349,7 +349,7 @@ =head1 VERSION -This document describes MCE::Loop version 1.875 +This document describes MCE::Loop version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Map.pm new/MCE-1.876/lib/MCE/Map.pm --- old/MCE-1.875/lib/MCE/Map.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Map.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (Subroutines::ProhibitSubroutinePrototypes) @@ -434,7 +434,7 @@ =head1 VERSION -This document describes MCE::Map version 1.875 +This document describes MCE::Map version 1.876 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Mutex/Channel.pm new/MCE-1.876/lib/MCE/Mutex/Channel.pm --- old/MCE-1.875/lib/MCE/Mutex/Channel.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Mutex/Channel.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized once ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; use base 'MCE::Mutex'; use Scalar::Util qw(weaken); @@ -139,7 +139,7 @@ =head1 VERSION -This document describes MCE::Mutex::Channel version 1.875 +This document describes MCE::Mutex::Channel version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Mutex/Channel2.pm new/MCE-1.876/lib/MCE/Mutex/Channel2.pm --- old/MCE-1.875/lib/MCE/Mutex/Channel2.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Mutex/Channel2.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized once ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; use base 'MCE::Mutex::Channel'; use MCE::Util (); @@ -116,7 +116,7 @@ =head1 VERSION -This document describes MCE::Mutex::Channel2 version 1.875 +This document describes MCE::Mutex::Channel2 version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Mutex/Flock.pm new/MCE-1.876/lib/MCE/Mutex/Flock.pm --- old/MCE-1.875/lib/MCE/Mutex/Flock.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Mutex/Flock.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized once ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; use base 'MCE::Mutex'; use Fcntl ':flock'; @@ -183,7 +183,7 @@ =head1 VERSION -This document describes MCE::Mutex::Flock version 1.875 +This document describes MCE::Mutex::Flock version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Mutex.pm new/MCE-1.876/lib/MCE/Mutex.pm --- old/MCE-1.875/lib/MCE/Mutex.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Mutex.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (TestingAndDebugging::ProhibitNoStrict) @@ -76,7 +76,7 @@ =head1 VERSION -This document describes MCE::Mutex version 1.875 +This document describes MCE::Mutex version 1.876 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Queue.pm new/MCE-1.876/lib/MCE/Queue.pm --- old/MCE-1.875/lib/MCE/Queue.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Queue.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (Subroutines::ProhibitExplicitReturnUndef) ## no critic (TestingAndDebugging::ProhibitNoStrict) @@ -1395,7 +1395,7 @@ =head1 VERSION -This document describes MCE::Queue version 1.875 +This document describes MCE::Queue version 1.876 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Relay.pm new/MCE-1.876/lib/MCE/Relay.pm --- old/MCE-1.875/lib/MCE/Relay.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Relay.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized numeric ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (Subroutines::ProhibitSubroutinePrototypes) @@ -368,7 +368,7 @@ =head1 VERSION -This document describes MCE::Relay version 1.875 +This document describes MCE::Relay version 1.876 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Signal.pm new/MCE-1.876/lib/MCE/Signal.pm --- old/MCE-1.875/lib/MCE/Signal.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Signal.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized once ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (BuiltinFunctions::ProhibitStringyEval) @@ -438,7 +438,7 @@ =head1 VERSION -This document describes MCE::Signal version 1.875 +This document describes MCE::Signal version 1.876 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Step.pm new/MCE-1.876/lib/MCE/Step.pm --- old/MCE-1.875/lib/MCE/Step.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Step.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (Subroutines::ProhibitSubroutinePrototypes) @@ -697,7 +697,7 @@ =head1 VERSION -This document describes MCE::Step version 1.875 +This document describes MCE::Step version 1.876 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Stream.pm new/MCE-1.876/lib/MCE/Stream.pm --- old/MCE-1.875/lib/MCE/Stream.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Stream.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (Subroutines::ProhibitSubroutinePrototypes) @@ -671,7 +671,7 @@ =head1 VERSION -This document describes MCE::Stream version 1.875 +This document describes MCE::Stream version 1.876 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Subs.pm new/MCE-1.876/lib/MCE/Subs.pm --- old/MCE-1.875/lib/MCE/Subs.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Subs.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (Subroutines::ProhibitSubroutinePrototypes) ## no critic (TestingAndDebugging::ProhibitNoStrict) @@ -204,7 +204,7 @@ =head1 VERSION -This document describes MCE::Subs version 1.875 +This document describes MCE::Subs version 1.876 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE/Util.pm new/MCE-1.876/lib/MCE/Util.pm --- old/MCE-1.875/lib/MCE/Util.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE/Util.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized numeric ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (BuiltinFunctions::ProhibitStringyEval) @@ -429,7 +429,7 @@ =head1 VERSION -This document describes MCE::Util version 1.875 +This document describes MCE::Util version 1.876 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE.pm new/MCE-1.876/lib/MCE.pm --- old/MCE-1.875/lib/MCE.pm 2021-11-16 10:04:41.000000000 +0100 +++ new/MCE-1.876/lib/MCE.pm 2021-12-02 23:52:19.000000000 +0100 @@ -11,7 +11,7 @@ no warnings qw( threads recursion uninitialized ); -our $VERSION = '1.875'; +our $VERSION = '1.876'; ## no critic (BuiltinFunctions::ProhibitStringyEval) ## no critic (Subroutines::ProhibitSubroutinePrototypes) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/lib/MCE.pod new/MCE-1.876/lib/MCE.pod --- old/MCE-1.875/lib/MCE.pod 2021-11-16 10:05:58.000000000 +0100 +++ new/MCE-1.876/lib/MCE.pod 2021-12-02 23:52:19.000000000 +0100 @@ -5,7 +5,7 @@ =head1 VERSION -This document describes MCE version 1.875 +This document describes MCE version 1.876 Many-Core Engine (MCE) for Perl helps enable a new level of performance by maximizing all available cores. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/t/03_max_workers.t new/MCE-1.876/t/03_max_workers.t --- old/MCE-1.875/t/03_max_workers.t 2021-11-16 09:47:53.000000000 +0100 +++ new/MCE-1.876/t/03_max_workers.t 2021-12-02 23:25:35.000000000 +0100 @@ -116,8 +116,8 @@ ); $mce = MCE->new(max_workers => '200%'); - is($mce->max_workers(), 16, - "check that max_workers=>'200%' is 16 on HW with 16 logical cores" + is($mce->max_workers(), 32, + "check that max_workers=>'200%' is 32 on HW with 16 logical cores" ); $mce = MCE->new(user_tasks => [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MCE-1.875/t/05_mce_child_max_workers.t new/MCE-1.876/t/05_mce_child_max_workers.t --- old/MCE-1.875/t/05_mce_child_max_workers.t 1970-01-01 01:00:00.000000000 +0100 +++ new/MCE-1.876/t/05_mce_child_max_workers.t 2021-12-02 23:09:39.000000000 +0100 @@ -0,0 +1,76 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use Test::More; + +BEGIN { + use_ok 'MCE::Child'; +} + +{ + no warnings 'redefine'; + sub MCE::Util::get_ncpu { return 16; } +} + +{ + # When max_workers is specified... (default undef, unlimited) + # Going higher than the HW ncpu limit is possible. Simply specify the + # number of workers desired. The minimum number of workers is 1. + + MCE::Child->init(max_workers => 0); + is(MCE::Child->max_workers(), 1, "check that max_workers=>0 is 1"); + + MCE::Child->max_workers(5); + is(MCE::Child->max_workers(), 5, "check that max_workers=>5 is 5"); + + MCE::Child->max_workers(20); + is(MCE::Child->max_workers(), 20, "check that max_workers=>20 is 20"); +} + +{ + # 'auto' is the number of logical processors. + + MCE::Child->init(max_workers => 'auto'); + is(MCE::Child->max_workers(), 16, + "check that max_workers=>'auto' is 16 logical cores" + ); +} + +{ + # One may specify a percentage starting with MCE::Child 1.876. + # The minimum number of workers is 1. + + MCE::Child->init(max_workers => '0%'); + is(MCE::Child->max_workers(), 1, + "check that max_workers=>'0%' is 1 on HW with 16 logical cores" + ); + + MCE::Child->max_workers('1%'); + is(MCE::Child->max_workers(), 1, + "check that max_workers=>'1%' is 1 on HW with 16 logical cores" + ); + + MCE::Child->max_workers('25%'); + is(MCE::Child->max_workers(), 4, + "check that max_workers=>'25%' is 4 on HW with 16 logical cores" + ); + + MCE::Child->max_workers('37.5%'); + is(MCE::Child->max_workers(), 6, + "check that max_workers=>'37.5%' is 6 on HW with 16 logical cores" + ); + + MCE::Child->max_workers('100%'); + is(MCE::Child->max_workers(), 16, + "check that max_workers=>'100%' is 16 on HW with 16 logical cores" + ); + + MCE::Child->max_workers('200%'); + is(MCE::Child->max_workers(), 32, + "check that max_workers=>'200%' is 32 on HW with 16 logical cores" + ); +} + +done_testing; +
