Skip to content

Instantly share code, notes, and snippets.

@khan5v
Created November 17, 2016 09:45
Show Gist options
  • Save khan5v/7d54becdab184873e35bd5e2c6875e59 to your computer and use it in GitHub Desktop.
Save khan5v/7d54becdab184873e35bd5e2c6875e59 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Parallel::SubFork;
use Data::Dumper;
my $manager = Parallel::SubFork->new();
for(1..10) {
$manager->start(\&cb, [$_]);
}
$manager->wait_for_all();
sub cb {
my $args = shift;
print "($$) has started with arguments:\n";
print Dumper $args || "No args\n";
for(1..$args->[0]*1000) {
my $x = $_ + 123;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment