There's more than one way to do things | |
PerlMonks |
Re: PerlIO::gzip and Parallel::ForkManager do not play niceby marioroy (Prior) |
on Mar 29, 2016 at 02:46 UTC ( [id://1158989]=note: print w/replies, xml ) | Need Help?? |
Hi Pascal666, The following are three parallel demonstrations using MCE::Flow, MCE::Hobo, and threads. The shared input and output handles are managed by MCE::Shared. MCE::Flow and MCE::Shared Many-Core Engine provides chunking abilities not used here.
MCE::Hobo and MCE::Shared A Hobo is a migratory worker inside the machine that carries the asynchronous gene. Hobos are equipped with threads-like capability for running code asynchronously. Unlike threads, each hobo is a unique process to the underlying OS. The IPC is managed by MCE::Shared, which runs on all the major platforms including Cygwin.
threads and MCE::Shared The code for MCE::Hobo and threads are very similar.
All three examples work across the board including with Perl on Windows and Cygwin, provided the OS has the gzip binary and the PerlIO::gzip module installed. Update: The upcoming MCE::Shared 1.002 release will support the following construction by allowing the main or worker process to handle the error. I've been wanting for the shared open call to feel like the native open call.
Kind regards, Mario
In Section
Seekers of Perl Wisdom
|
|