XP is just a number | |
PerlMonks |
Re: What is this "Do you need to predeclare croak" about?by marioroy (Prior) |
on Jun 14, 2017 at 21:44 UTC ( [id://1192837]=note: print w/replies, xml ) | Need Help?? |
Hello karlgoethebier, The demonstration looks fine. Some modules may not play well with threads, unfortunately. The LWP::Simple module has many dependencies. One of them may be unsafe for use with threads. In that case, the use_threads option is necessary to have workers spawn via fork on the Windows platform or when loading threads at the top of the script. Network related tasks may benefit from MCE's interval option. It helps stagger the immediate code that follows. For this use-case, calling yield prevents workers from initiating remote connections at the same time. It is similarly to sleep, but runs serially, not parallel, for that duration of time. All participating workers wait their turn to sleep. The next MCE update 1.830 will default to 1 for the posix_exit option. It is nearly impossible to manage a list of modules thread-safe or multi-process END safe for that matter.
MCE Loop is wantarray-aware. This allows one to use the gather method to send the key-value pair into a plain hash. For readers, this is how it was done before MCE::Shared came about.
Regards, Mario
In Section
Seekers of Perl Wisdom
|
|