Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^4: Code brewing for the upcoming MCE 10 year anniversary

by marioroy (Prior)
on Oct 24, 2022 at 04:59 UTC ( [id://11147636]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Code brewing for the upcoming MCE 10 year anniversary
in thread Code brewing for the upcoming MCE 10 year anniversary

Or using MCE::Loop instead. One can have MCE::Loop gather orderly via MCE::relay.

use MCE::Simple ( include => [qw/ -strict -signatures -mce_loop /], max_workers => 4, init_relay => '', ); MCE::Simple->init( on_finish => sub ( $pid, $exit, $ident, $signal, $error, @ret ) { say "MCE job ** $ident ** completed; status $exit."; print join('', @ret); }, ); spawn "foo", sub { my @results = mce_loop { my $output = "From chunk_id: ".MCE->chunk_id."\n"; for my $i (@{ $_ }) { $output .= "$i\n"; } MCE::relay { MCE->gather($output); }; } 91..99; }; # do something else sync;

Thank you, PerlMonks. I was able to think out loud. The demonstrations work flawlessly.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11147636]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-20 16:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found