athanasia has asked for the wisdom of the Perl Monks concerning the following question:
The output I am getting is :use Win32::OLE('in'); use POSIX":sys_wait_h"; my $pid = fork(); my $check; die "can't fork:$?" unless(defined $pid); if ($pid != 0) { print "I am the parent\n"; my $flag = 0; while ($flag == 0) { $check = waitpid($pid,&WNOHANG); print "Waitpid returned $check\n"; if ($check > 0) { print "Parent caught death of child $pid\n"; $flag = 1; } else { sleep 1; print "Not yet caught\n"; } } print "Parent is exiting\n"; } else { print "I am the child\n"; sleep 3; print "Child is exiting\n"; exit (0); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Waitpid does not work as expected in Windows
by ikegami (Patriarch) on Sep 29, 2008 at 10:47 UTC | |
by athanasia (Pilgrim) on Sep 29, 2008 at 11:33 UTC | |
by ikegami (Patriarch) on Sep 29, 2008 at 11:50 UTC | |
by athanasia (Pilgrim) on Sep 29, 2008 at 12:11 UTC |