Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sober-wang opened this issue Jun 6, 2023 · 1 comment
Open

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

sober-wang opened this issue Jun 6, 2023 · 1 comment

Comments

@sober-wang
Copy link

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

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

@thinkgos
Copy link

thinkgos commented Jan 3, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants