Mayank Jain <[EMAIL PROTECTED]> wrote:> [Code, and successful experiment 
deleted]

> However, how do i make this wait by the parent a non-blocking 
 > wait?
   
 Um, what do you mean by a "non-blocking wait." Calling
 wait()/waitpid() means that you *want* the parent process to
 wait for the child to finish processing (or, some other condition
 occurs, as specified in the 3rd argument).
 
> This is because while checking for "has the child died", parent 
 > is blocked by waitpid & hence cannot do other processing.

 If you want the parent to continue some processing, you can 
 either fork another child for this, or set up the child to signal the
 parent when it exits, rather than using wait()/waitpid().
 
> I've tried using WNOHANG in waitpid as waitpid(child, &status,
 > WNOHANG) & this is the output i get
 This behaviour with WNOHANG is not surprising. As the manpage
 tells you, with this option, waitpid() returns immediately if the child
 has not exited. Incidentally, though this is probably not an issue here,
 you cannot depend on the order of messages from a child/parent to
 tell you which finished processing first.
 
 Regards,
 Gora


Send instant messages to your online friends http://in.messenger.yahoo.com 
_______________________________________________
ilugd mailinglist -- ilugd@lists.linux-delhi.org
http://frodo.hserus.net/mailman/listinfo/ilugd
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
http://www.mail-archive.com/ilugd@lists.linux-delhi.org/

Reply via email to