in reply to Re^3: while reading a file, transfer the same data to two different processes.
in thread while reading a file, transfer the same data to two different processes.

But here "function1" and "function2" are not processing just for every record. they are processing first record and then join the results to second record after processing and so on...so in short i cannot kill the process while returning to start of the loop.
  • Comment on Re^4: while reading a file, transfer the same data to two different processes.

Replies are listed 'Best First'.
Re^5: while reading a file, transfer the same data to two different processes.
by JavaFan (Canon) on May 20, 2010 at 16:21 UTC
    Then your setup is flawed. You do not want to fork in each iteration.

    Why not fork before opening the file, and have each subprocess iterate over the file and process it? Or just write two programs?

    Of course, if there even more non-obvious requirements, list them first ;-)