Steffen Mueller wrote:
Hi Jan,

since we're already off topic already, let me abuse this thread a little more:

Jan Dubois schrieb:
I don't know about Win32::Process::Info, but you definitely cannot use
Win32::OLE in a program that uses (pseudo-)fork.

Also related to pseudo-fork. Is it possible to somehow kill pseudo-forked children without the risk to corrupt the interpreter? This would allow us to get Test:HTTP::Server::Simple and many other modules to work on win32 (albeit with some additional trickery).

It is a long
outstanding issue, and not trivial to implement.  Maybe I'll get around
to it sometime this year, but I've been saying this for a while now...

I bet it's not trivial.

Thanks for your time.

Steffen

Is this what you mean by killing? The example below loops/forks three times, killing the child processes in-between forks.
-------------paste test code
#!/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.


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";
    sleep(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";
  sleep(2);
  print "810\n";
  exit;
} else {
  # Failed to fork
  print "820: Failed to fork:$!:\n";
  exit;
}
#...........................................
print "910\n";




Reply via email to