Can a parent process determine its child's status ?
adh at mva.cs.liv.ac.uk
adh at mva.cs.liv.ac.uk
Tue Feb 20 23:18:50 AEST 1990
Does anyone know how a parent process can determine the status of one
of its children if it *hasn't* executed a wait ? It could arrange to
catch a SIGCLD signal, but if the parent had several children it
wouldn't know which one had sent it the SIGCLD ... would it ?
My reason for asking is as follows: I need to write a program which
starts several children and reads from their respective stdout's via
pipes. The children are executing simultaneously, so the parent uses
non-blocking reads, polling each pipe to see if anything has arrived.
Unfortunately, a call to 'read' returns zero if the child hasn't
sent any new data *OR* if the child has terminated so the parent cannot
distinguish between EOF on a pipe and a pipe that temporarily has no
data in it.
Any advice and suggestions would be appreciated.
Thanks
David Harper
University of Liverpool Computer Laboratory
Liverpool, U.K.
Preferred path for email replies: qq68 at liverpool.ac.uk
More information about the Comp.unix.questions
mailing list