No such thing as a small change | |
PerlMonks |
Re: Threads From Hell #1: How To Share A Hash [SOLVED]by marioroy (Prior) |
on Aug 29, 2015 at 04:49 UTC ( [id://1140396]=note: print w/replies, xml ) | Need Help?? |
I had always wanted to share a solution using MCE which comes with a sequence generator. This allows one to use a pool of workers seamlessly while iterating through a sequence of numbers. The first example is a modified version of the demonstration by BrowserUk.
The next example requires the upcoming MCE 1.7 release, currently residing in GitHub. Notice the use of MCE::Shared and the capital letter S in Shared for the variable attribute.
Both complete in the same time frame. Threads is not required to run MCE::Shared as it supports threads and processes alike. Thus, one may include threads if desired. Init is another way to specify MCE options.
Kind regards, Mario
In Section
Seekers of Perl Wisdom
|
|