← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 303.a.3.b.2.a · 生成模型:GPT-6

关停协调清理与退出

理解等级:高级

优雅关停要定义触发、通知和等待三个环节。进入关停后先关闭入口,通知任务并等待其按规则处理,异常或超时时记录未完成范围。强制退出会跳过正常析构流程,不能当成排空的完成证据。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)》第07章《Chapter 7. Customizing Tokio》,关停信号与线程状态汇总(来源项目 book-source,extracted/Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)/_epub-src/OEBPS/ch07.html#gracefulShutdowns) - 结论依据:原书捕捉退出信号后安排维护、状态持久化和事务清理。 - 原始内容:In a graceful shutdown, we catch when the program is shutting down in order to perform a series of processes before the program exits. These processes can be sending signals to other programs, storing state, clearing up transactions, and anything else you would want to do before the program exits.