async-book icon indicating copy to clipboard operation
async-book copied to clipboard

rust 如何避免 async 任务泄漏呢?

Open sober-wang opened this issue 1 year ago • 1 comments

作为 golang 程序员,我知道可以用 done channel 或 context 将 goroutine 关闭,以防止 goroutine 的泄漏。

如果一个 rust 程序中有大量的 async 并行,程序员忘记 close() 或 join() 势必会造成 async 泄漏。rust 是如何避免这种情况的?

sober-wang avatar Jun 06 '23 05:06 sober-wang

说说怎么个泄漏法? 如何是 async 终止不了, 这不应该是程序bug啊. 需要控制终止, 看下channel或 async channel.

thinkgos avatar Jan 03 '24 02:01 thinkgos