• kill child processes on STOP to program GUARDIAN

    From Luis Silva@21:1/5 to All on Wed Feb 3 18:00:10 2021
    Hi,
    I have an application written in C99 which calls PROCESS_LAUNCH_ to start other c99 programs.

    When I runa a STOP command int TACL to my PROCESS_LAUNCH_ program I want to kill all children that were started by my program.

    Is there a way to do that?

    Rigth now if I kill parent program child programs are still up but not running.

    Thank you in advance

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bill Honaker@21:1/5 to Luis Silva on Thu Feb 4 12:39:39 2021
    On Wed, 3 Feb 2021 18:00:10 -0800 (PST), Luis Silva <hewey01@gmail.com> wrote:

    Hi,
    I have an application written in C99 which calls PROCESS_LAUNCH_ to start other c99 programs.

    When I runa a STOP command int TACL to my PROCESS_LAUNCH_ program I want to kill all children that were started by my program.

    Is there a way to do that?

    Rigth now if I kill parent program child programs are still up but not running.

    Thank you in advance

    There is no standard builtin to do this. You can, of course, write a custom TACL routine to do that, but it's not very straightforward.
    Bill

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Keith Dick@21:1/5 to Bill Honaker on Thu Feb 4 22:19:32 2021
    On Thursday, February 4, 2021 at 10:39:41 AM UTC-8, Bill Honaker wrote:
    On Wed, 3 Feb 2021 18:00:10 -0800 (PST), Luis Silva <hew...@gmail.com> wrote:

    Hi,
    I have an application written in C99 which calls PROCESS_LAUNCH_ to start other c99 programs.

    When I runa a STOP command int TACL to my PROCESS_LAUNCH_ program I want to kill all children that were started by my program.

    Is there a way to do that?

    Rigth now if I kill parent program child programs are still up but not running.

    Thank you in advance
    There is no standard builtin to do this. You can, of course, write a custom TACL routine to do that, but it's not very straightforward.
    Bill

    I think you can do what you want using the JOBID option of the RUN command and the STOP option of the STATUS command to stop the processes. I'm not absolutely sure this will work, and you are going to have to read the manuals to figure out the exact
    syntax.

    If I remember correctly, the JOBID option can be used to make all processes started by the one you give the JOBID to have that same JOBID, so they can be associated with each other. When you do not use JOBID, the processes don't have an easy way to be
    associated with each other. The JOBID is just a number. You would specify it something like this:

    RUN your-prog /JOBID 1/

    Of course, you can include any other RUN options between the slashes, too.

    The STATUS command has a way to select processes by JOBID. I believe you must specify both the top-level process's process name and the JOBID connected with a period.

    So if you started your program using RUN your-prog/NAME $XYZ,JOBID 1/ then a command something like:

    STATUS *, GMOMJOBID $XYZ.1

    would show all the processes that have JOBID 1 and were started by $XYZ. If I'm remembering that correctly, you could stop them all with the command

    STATUS *, GMOMJOBID $XYZ.1, STOP, FORCED

    I don't remember whether those STATUS commands will include the top-level process $XYZ in their action. If not, you would have to stop it with a separate command. Or you could, write a fairly short TACL macro to combine the two commands so that you can
    enter just the command to run the macro (the top-level process name would be the argument to the macro).

    It is possible I'm remembering some details of this incorrectly and you'll find it won't work as I think it does. If that is the case, describe the problem you run into and we might be able to figure out what I got wrong and fix it.

    If something prevents this from working the way I think it does, another approach would be to make your top-level program open and read its $RECEIVE file, and if it receives a line containing whatever you want to use as a signal that it should stop, have
    it stop all the processes it started, then stop itself. Whether you would use an approach of reading from the $RECEIVE file every once in a while (with waited I/O and a short timeout) or use nowait I/O on $RECEIVE would depend on which is easier to fit
    into the logic of your program. Or if your program prompts for commands already, just define a new command that tells it to stop all the processes it started and then stop itself.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)