in reply to Re^8: adding a hash to a shared object
in thread adding a hash to a shared object
If your subroutines are only ever called once, what gains do you hope to get from parallelizing them?
My approach would be to not store any data but to forward it to whatever subroutine. If you want to do some processing after a subroutine has consumed all data passed to it, do it just there:
sub accumulate { async { my %totals; while (defined (my $payload = $q2->dequeue())) { $totals{ $payload }++; }; # Processing has finished print_to_json(\%totals); }; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: adding a hash to a shared object
by daverave (Scribe) on Aug 11, 2010 at 13:34 UTC | |
by Corion (Patriarch) on Aug 11, 2010 at 13:41 UTC | |
by daverave (Scribe) on Aug 11, 2010 at 15:22 UTC |