[LCP]Fork freezes when forking more then one

Steve Baker ice at mama.indstate.edu
Tue Aug 26 03:39:02 UTC 2003


juman <juman at chello.se> wrote:
> The sleep is only so I can check which processes is running.
> But if I run 2 processes as can be seen in the real program the software
> freezes when trying to read the output of the first process. Can somebody help
> me with what I do wrong when trying to exit the forked process and read their
> output?

  From the look of it, you're failing to close the client side pipe
descriptors on the parent side after you've forked and exec'ed your new
program you wish to read from.  When the child exits, the close on the pipe
will not be registered since the parent also has an open file handle, thus any
further reads on the pipe will block forever.



More information about the linuxCprogramming mailing list