fork - How can I be notified when a background process terminates in Perl? -
I wrote a Pearl program, which shakes a background program in the hair process and calls and no endless loop What happens is that whatever the stuff does in the original process now the loop should be left when the background program ends in the child process:
$ pid = fork (); If (! $ Pid) {exec ("Program Arguments"); } Else {While (1) {# need some help: if the program is finished, break}}
OK, Kankaya
gives your child's PID to the original process (which you retrieve dutyfully in your code). It is fine that parents can take care of the child.
To leave the loop over, you can check whether the child still exists or not by using kill $ $ pid
. See perldoc -f kill
.
Comments
Post a Comment