GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
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>
2022-04-09 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.