[Gjegjeza] and faqja për një sasi të lumtur në lidhje me ritregimin e shqiptarëve për fundin e [gjëzë]/[gjëzë përfundimin e]...
Më të tillë, kështu që Kshqiti i Gjegjes është të'mehëh'.
Q:
How can I run multiple time() statements in parallel with Perl's Parallel::ForkManager
I'm trying to run multiple time() statements in parallel using Perl's Parallel::ForkManager, but I can't get it to work. I've tried the following:
use strict;
use warnings;
use feature'say';
use 5.10.1;
use Parallel::ForkManager;
use POSIX 'time';
my $pm = new Parallel::ForkManager(5);
$pm->add_listeners(qw/run/);
foreach my $t (1..10) {
say time() + $t;
$pm->start and next;
}
$pm->wait_all_children;
say "Done";
However, that just prints out one output per run of the script, and runs every one of the 5 threads in sequence. I'd like to print out 5 times with a delay between them.
Can anyone help?
A:
It appears that each time you call time, the callback gets called once, with the result of time.
You'll need to spawn separate processes. Here's a complete example:
How to check if a particular row exist in pandas data
Related links:
Comentários