我在Unix系统上使用了perl中的以下代码模式,但它在Windows上崩溃。如何在Windows上使用perl使用forking或线程来实现相同的功能?
use Parallel::ForkManager;
my $pm = Parallel::ForkManager->new($MAX_PROCESSES);
DATA_LOOP:
foreach my $data (@all_data) {
# Forks and returns the pid for the child:
my $pid = $pm->start and next DATA_LOOP;
# ... do some work with $data in the child process ...
$pm->finish; # Terminates the child process
}
https://stackoverflow.com/questions/41475159
复制