unix pipe multiple writers

后端 未结 1 786
孤城傲影
孤城傲影 2021-01-12 12:56

If there are multiple threads writing fixed length data (say 4 byte address) to a single pipe and there is a single reader of that pipe, is it guaranteed that the reader wil

相关标签:
1条回答
  • 2021-01-12 13:22

    http://pubs.opengroup.org/onlinepubs/009695399/functions/write.html

    Atomic/non-atomic: A write is atomic if the whole amount written in one operation is not interleaved with data from any other process. This is useful when there are multiple writers sending data to a single reader. Applications need to know how large a write request can be expected to be performed atomically. This maximum is called {PIPE_BUF}. This volume of IEEE Std 1003.1-2001 does not say whether write requests for more than {PIPE_BUF} bytes are atomic, but requires that writes of {PIPE_BUF} or fewer bytes shall be atomic.

    0 讨论(0)
提交回复
热议问题