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:

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 my original solution, 'create new process' was done with system(1,...) and killing was done with kill -9.

-- 
Ronald Fischer <ynnor@mm.st>

In reply to Re^4: Win32::Job::watch vs. system(1,...) by rovf
in thread Win32::Job::watch vs. system(1,...) by rovf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.