in reply to Re^2: Threads memory consumption
in thread Threads memory consumption
It is possible to pass result to parent process, and is quite easy. You can use Parallel::ForkManager for example:
use 5.010; use strict; use warnings; use Parallel::ForkManager; use Data::Printer; my $pm = Parallel::ForkManager->new(2); $pm->run_on_finish( sub { # result from the child will be passed as 6th arg to callback my $res = $_[5]; p $res; } ); for (1..3) { $pm->start and next; # from here and till $pm->finish child process running # do something useful and store result in $res my $res = { aaa => $_ }; # this will terminate child and pass $res to parent process $pm->finish(0, $res); } $pm->wait_all_children;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Threads memory consumption
by mojo2405 (Acolyte) on Dec 06, 2013 at 12:16 UTC | |
by zentara (Archbishop) on Dec 06, 2013 at 17:55 UTC | |
by zwon (Abbot) on Dec 06, 2013 at 15:07 UTC | |
by mojo2405 (Acolyte) on Dec 08, 2013 at 09:18 UTC | |
by zwon (Abbot) on Dec 08, 2013 at 15:38 UTC | |
by mojo2405 (Acolyte) on Dec 19, 2013 at 19:09 UTC |
In Section
Seekers of Perl Wisdom