Hello,

It has been a good while since I tried Windows fork. It never worked before. Now it does, and it works with a pp'd executable, too. Good stuff. I have perl, v5.8.8, par -.960.

------------paste fork test
#!/usr/bin/perl -w
# file: test_windows_fork_02.pl
# 1. Have the children take longer than the parent will allow.
# 2. Have the children finish within the parent's allotted time limit.

sub sleeper {
 my ($sleep_time) = @_;
 sleep($sleep_time);
}


my $done = 0;
my $count = 0;

while (!($done)) {
 $count++;
 print "105: count $count\n";

 #...........................................
 if (my $pid = fork()) { # Parent
   print "115: count $count\n";
   select(undef, undef, undef, 1.00);

   kill 9, $pid;
   $done = 1 if ($count == 3);
   print "115: count $count\n";

 }
 elsif(defined $pid) { # Child
   print "205\n";
   sleeper(40);
   exit;
 } else {
   # Failed to fork
   print "Failed to fork:$!:\n";
   exit;
 }
 #...........................................
 print "510\n";

}
print "610\n";

#...........................................
if (my $pid = fork()) { # Parent
 print "705: \n";
 select(undef, undef, undef, 4.00);
 kill 9, $pid;

}
elsif(defined $pid) { # Child
 print "805\n";
 sleeper(2);
 print "810\n";
 exit;
} else {
 # Failed to fork
 print "820: Failed to fork:$!:\n";
 exit;
}
#...........................................
print "910\n";

------------end paste fork test



Reply via email to