async-blocking-runtime

async-blocking-runtime

这个示例用于复现博客里提到的典型误区:在 async 任务中直接执行阻塞操作,导致运行时线程被占住,影响其他任务调度。

关联文章:_posts/2026-04-30-rust-async-await-future-poll-tokio-runtime.md

运行方式

在本目录下执行:

cargo run -- bad

或:

cargo run -- good

两种模式说明

预期观察点

测试用例(demo)

在本目录执行:

cargo test -- --nocapture

当前包含一个测试:blocking_sleep_in_async_reduces_runtime_progress

My Github Page: https://github.com/liweinan

B站视频: https://space.bilibili.com/21947620

Powered by Jekyll and Theme by solid

If you have any question want to ask or find bugs regarding with my blog posts, please report it here:
https://github.com/liweinan/liweinan.github.io/issues