A new parallel module was recently added to CPAN called MCE. This is how one could run 2 functions in parallel using MCE.
#!/usr/bin/perl use 5.014; use MCE; my $mce = MCE->new( max_workers => 2, user_func => sub { my $self = shift; if ($self->wid == 1) { test1(); } else { test2(); } } ); $mce->run(); sub test1 { sleep 3; say "in test1"; } sub test2 { sleep 2; say "in test2"; }
Output
in test2 in test1
In reply to Re: parallel functions
by marioroy
in thread parallel functions
by micmac
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |