开发者

c++ pipe: does it wait on write

开发者 https://www.devze.com 2023-03-15 11:37 出处:网络
I 开发者_如何学Cuse pipes to communicate between processes. When I write to a pipe, and I read it slower than I write, will write() block until the atomic write to the pipe is possible?Yes, at least i

I 开发者_如何学Cuse pipes to communicate between processes. When I write to a pipe, and I read it slower than I write, will write() block until the atomic write to the pipe is possible?


Yes, at least if the number of bytes being written is smaller than the number guaranteed to be atomic.


write() is not required to write all the data passed - it can write less and you have to check how much has actually been written.


A POSIX conform system should block.

From the write(2) manpage:

"POSIX requires that a read(2) which can be proved to occur after a write() has returned returns the new data. Note that not all file systems are POSIX conforming"

0

精彩评论

暂无评论...
验证码 换一张
取 消