← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 1669.a.1.a.1 · 生成模型:GPT-6

WouldBlock保留进度

理解等级:高级

非阻塞操作的 WouldBlock 通常需要保存已经消费或发送的字节及协议进度,再等待后续就绪。成功 read 返回 0 才是流结束信号之一。就绪不保证整帧已经到齐,重用缓冲和偏移才能应对拆包与短写。关联 [[就绪令牌定位资源]]。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)》第04章《Chapter 4. Integrating Networking into Our Own Async Runtime》,非阻塞读写与分帧(来源项目 book-source,extracted/Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)/_epub-src/OEBPS/ch04.html#id29) - 结论依据:原书以暂时无数据为例,区分 WouldBlock 与致命 I/O 错误。 - 原始内容:It works, but we get the initial error. This can be a result of nonblocking TCP listeners; mio is nonblocking. The Resource temporarily unavailable error is usually caused by no data being available in the socket. This can happen when the TCP stream is created, but it is not a problem because we handle these errors in our loop and are returning Pending so the