Re: How do I make process wait on child or kill ?
From: Alex Fraser (me_at_privacy.net)
Date: 03/29/05
- Next message: Panama Red: "Re: I cant seem to get nanosleep to work (beginner)"
- Previous message: Gordon Burditt: "Re: How do I make process wait on child or kill ?"
- In reply to: codefixer_at_gmail.com: "How do I make process wait on child or kill ?"
- Next in thread: codefixer_at_gmail.com: "Re: How do I make process wait on child or kill ?"
- Reply: codefixer_at_gmail.com: "Re: How do I make process wait on child or kill ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Panama Red: "Re: I cant seem to get nanosleep to work (beginner)"
- Previous message: Gordon Burditt: "Re: How do I make process wait on child or kill ?"
- In reply to: codefixer_at_gmail.com: "How do I make process wait on child or kill ?"
- Next in thread: codefixer_at_gmail.com: "Re: How do I make process wait on child or kill ?"
- Reply: codefixer_at_gmail.com: "Re: How do I make process wait on child or kill ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|