根据pipe的手册页:
If a process attempts to read from an empty pipe, then read(2) will
block until data is available. If a process attempts to write to a
full pipe (see below), then write(2) blocks until sufficient data has
been read from the pipe to allow the write to complete. Nonblocking
I/O is possible by using the fcntl(2) F_SETFL operation to enable the
O_NONBLOCK open file status flag.
我有这样一个问题:
如果管道缓冲区为空;
读取在管道上阻塞;
现在,如果正在关闭写入结束,是否会自动取消阻止读取?
答案 0 :(得分:3)
是的,read
将被取消阻止并返回EOF(0)。