in reply to Re^4: 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.

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 ;-)

  • Comment on Re^5: while reading a file, transfer the same data to two different processes.