Created
July 26, 2012 19:12
-
-
Save earino/3183895 to your computer and use it in GitHub Desktop.
parallelized first stab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $pm = Parallel::ForkManager->new($PROCESSES); | |
my @list_of_work = qw/ BLAH BLAH BLAH /; | |
my @list_of_endpoints = qw/ YADDA YADDA YADDA /; | |
for my $unit_of_work (@list_of_work) { | |
my $pid = $pm->start and next; | |
for my $endpoint (@list_of_endpoints) { | |
my $value_retrieved = retrieve_value_from_stuff($unit_of_work); | |
do_stuff_to($value_retrieved); | |
push_value_retrieved_to($endpoint); | |
} | |
$pm->finish; # Terminates the child process | |
} | |
$pm->wait_all_children; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment