 |
|
| |
Parallel::Async::Chain(3) |
User Contributed Perl Documentation |
Parallel::Async::Chain(3) |
Parallel::Async::Chain - task chain manager.
- my @results = $chain->recv(@args)
- Execute tasks on child processes and wait for receive return values.
# create new task
my $task_add = async {
my ($x, $y) = @_;
return $x + $y;
};
my $task_sub = async {
my ($x, $y) = @_;
return $x - $y;
};
my $task_times = async {
my ($x, $y) = @_;
return $x * $y;
};
my $chain = $task_add->join($task_sub)->join($task_times);
my ($res_add, $res_sub, $res_times) = $chain->recv(10, 20);
say $res_add->[0]; ## 30
say $res_sub->[0]; ## -10
say $res_times->[0]; ## 200
- my @pids = $chain->run(@args)
- Execute tasks on child processes.
# create new task
my $task_add = async {
my ($x, $y) = @_;
return $x + $y;
};
my $task_sub = async {
my ($x, $y) = @_;
return $x - $y;
};
my $task_times = async {
my ($x, $y) = @_;
return $x * $y;
};
my $chain = $task_add->join($task_sub)->join($task_times);
my @pids = $chain->run(10, 20);
- my @pids = $chain->daemonize(@args)
- Execute tasks on daemonized processes.
# create new task
my $task_add = async {
my ($x, $y) = @_;
return $x + $y;
};
my $task_sub = async {
my ($x, $y) = @_;
return $x - $y;
};
my $task_times = async {
my ($x, $y) = @_;
return $x * $y;
};
my $chain = $task_add->join($task_sub)->join($task_times);
my @pids = $chain->daemonize(10, 20);
- $chain->join($task1, ...);
- Join multiple tasks, like Parallel::Async::Task#join.
- $task->reset;
- Reset the execution status of all tasks, like
Parallel::Async::Task#reset.
- $task->clone;
- Clone and reset the execution status of all tasks, like
Parallel::Async::Task#clone.
karupanerura <karupa@cpan.org>
Visit the GSP FreeBSD Man Page Interface. Output converted with ManDoc.
|