Basically you are right, but a bit simpler. I want to start a process (let's call it P), and this process might create any number of childs and grandchilds. After the process is started, my program is continuing to do other stuff. From time to time (when my program has nothing else to do, which is typically every few seconds), my program checks whether P is supposed to be killed, or whether it is allowed to continue running, or whether maybe it already has ended. This decision is done by looking whether a certain file exists (this file is created from a different side - from the viewpoint of my program, I only need to see whether the file exists or not). If this certain file exists, and P is still running, my program has to kill P and all its decendents.
Here the whole thing in pseudocode:
In my original solution, 'create new process' was done with system(1,...) and killing was done with kill -9.Create new process P while(1) { read next task process task if(P has ended) { evaluate result of P Create new process P } elsif(P should be killed) { kill P and its children Create new process P } }
In reply to Re^4: Win32::Job::watch vs. system(1,...)
by rovf
in thread Win32::Job::watch vs. system(1,...)
by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |