hi my question is the fallowing
I have many processes all writing to the same pipe how can I synchronize them so I don't have multiple processes writing to the pipe at the same time?
Thanks in advance.
hi my question is the fallowing
I have many processes all writing to the same pipe how can I synchronize them so I don't have multiple processes writing to the pipe at the same time?
Thanks in advance.
Last edited by scioner; 06-13-2008 at 11:24 PM.
You can't.
IIRC, each write() is atomic. So if you prepare what you want to write in a buffer, then use a single write() call to write it, then that data will be read at the other end of the pipe as a contiguous block (that is, not mixed up with anyone elses write calls).
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
sweeeet I did not know that, thats great. thanks man. i was still with thread mindset