Re: How do I make process wait on child or kill ?

From: Alex Fraser (me_at_privacy.net)
Date: 03/29/05


Date: Mon, 28 Mar 2005 23:17:16 +0100


<codefixer@gmail.com> wrote in message
news:1112038977.162287.250140@o13g2000cwo.googlegroups.com...
> I have a situation where I have to handle the following scenario.
> The main() must wait for child to complete or the main() must kill the
> child after 3 seconds and exit.

A quick hack is to use nanosleep()/waitpid(WNOHANG) in a loop. Better but
slightly more complex solutions include using SIGALRM to detect the timeout
(blocking on waitpid()) or SIGCHLD to detect the child's termination
(blocking on nanosleep()).

Alex



Relevant Pages

  • Re: Trying to understand this forking open stuff...
    ... parent starts: Wed Nov 8 13:45:14 2006 ... child starts: Wed Nov 8 13:45:14 2006 ... statements don't do execute until after the parent process is over. ... Look carefully at the times displayed, it is not blocking. ...
    (perl.beginners)
  • Re: How do I make process wait on child or kill ?
    ... Alex Fraser wrote: ... >> I have a situation where I have to handle the following scenario. ... >> The mainmust wait for child to complete or the mainmust kill ... > (blocking on nanosleep()). ...
    (comp.unix.programmer)
  • Re: Writing from a parant process to two child processes
    ... opened and the parent writes to the appropriate pipe. ... a child via exit. ... have been closed (so the child is blocking on a read). ...
    (comp.os.linux.development.apps)
  • Re: Does calling wait() poll?
    ... Once you fix the bugs in your program, it will be calling 'wait' ... 'wait' periodically to see if the child was finished. ... waiting until it is finished, you are blocking, not polling. ... Blocking is like "call me when you're ready". ...
    (comp.unix.programmer)
  • Re: Use Button To Call/Open 2nd Form & Pass Variable
    ... that decription seems to me to match the second scenario I ... parent record contains a field that relates to a record in a child table. ... DoCmd.OpenForm "frmChild", _ ...
    (microsoft.public.access.formscoding)