知识卡片

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

释放订阅者清除积压

理解等级:高级

订阅者离开时要停止继续积压并回收它的队列。Drop 无法直接等待异步锁,因而可把 ID 交给后台清理。收集标记应在同一临界区一次取走,避免先复制后清空时丢掉并发退订。订阅 ID 回收时也应提防旧句柄。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Chapter 6. Reactive Programming 退订、Drop 与垃圾回收 · 查看原书依据

      We also need to take care of dropping the handle. If the handle is removed from memory, there is no way to access the queue relating to the ID of that handle, because the handle stores the ID. However, events will keep getting sent to the queue of that ID. If a developer uses our queue and the handle is dropped in their code without

    参考来源

    - 位置:《Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)》第06章《Chapter 6. Reactive Programming》,退订、Drop 与垃圾回收(来源项目 book-source,extracted/Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)/_epub-src/OEBPS/ch06.html#id46) - 结论依据:原书说明句柄释放后若未删除队列,事件仍会发到无主队列。 - 原始内容:We also need to take care of dropping the handle. If the handle is removed from memory, there is no way to access the queue relating to the ID of that handle, because the handle stores the ID. However, events will keep getting sent to the queue of that ID. If a developer uses our queue and the handle is dropped in their code without