I've asked a question here before about multiple writers on a FIFO, and I know now that the write is thread safe as long as I write less than the PIPE_BIF, here is the link for that limit.
What about read? what if have two(or more) readers in multiple threads for reading from the same fifo, do I need locks here? or all I need is to read less than the PIPE_BUF?
BTW, I'm talking about Linux FIFO, And I'm using C.
Best Answer
Updated answer
Per the manual, you are NOT guaranteed atomic reads. However, their intent is for reads with FIFOs to be atomic. From paragraphs 2 and 4 of Rationale | Input and output
Until you see evidence otherwise, I would still be willing to say that you are fine.
Original answer
Based upon your previous question, I'm assuming all of your reads will be less than PIPE_BUF as well.
I don't believe you'll need any additional serialization around the reads since your unit of consumption is less than the guaranteed atomic, thread-safe write amount. If you had sequences of objects that needed to be read, then you would need some additional mechanism for serialization.