为什么 IO 多路复用要搭配非阻塞 IO?
的有关信息介绍如下:
man 2 select 「BUGS」节:
Under Linux, select() may report a socket file descriptor as "ready for reading", while nevertheless a subsequent read blocks. This could for example happen when
data has arrived but upon examination has wrong checksum and is discarded. There may be other circumstances in which a file descriptor is spuriously reported as
ready. Thus it may be safer to use O_NONBLOCK on sockets that should not block.
就算数据不会被别人读走,也可能被内核丢弃。还有文档没有明说的其它情况。


![iOS
闭包中的[weak self]在什么情况下需要使用,什么情况下可以不加?](/upload/zhihu/2026/1122/2a3759b6.png)
