pclose without waiting for child

This is a discussion on pclose without waiting for child within the C Programming forums, part of the General Programming Boards category; I'm creating a child process using popen and after a while I'm checking the result and close the pipe using ...

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    8

    pclose without waiting for child

    I'm creating a child process using popen and after a while I'm checking the result and close the pipe using pclose.

    Now the problem is that in some cases the child hasn't finished yet, so pclose will wait until the child finishes. But in this case I'm not interested in the result any more, so I don't want to wait for the child as this blocks my program.

    So my question is: Is there a way to close the pipe without waiting for the child? (so just kill the child).

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,558
    If you want more control, then you're going to have to use fork() / execl() as previously discussed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 11-21-2009, 12:02 AM
  2. simultaneously waiting for data on FIFO and UDP using select call
    By yogesh3073 in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-05-2007, 08:53 AM
  3. Placement of pclose
    By 3saul in forum Linux Programming
    Replies: 2
    Last Post: 02-17-2006, 12:07 AM
  4. Wait loop - not busy waiting?
    By Foldager in forum Windows Programming
    Replies: 1
    Last Post: 07-17-2003, 01:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21