Login
From:
夜天之书
(Uncensored)
subscribe
Async Rust 原语实现与品鉴
https://tisonkun.org/2025/09/02/mea-async-primitives/
links
backlinks
Tagged with:
rust
async
天工开物
Roast topics
Find topics
Find it!
Rust 标准库的 sync 模块提供了一系列并发原语,包括对应原子操作的 atomic 系列,实现 channel 通信的 mpsc 和 mpmc 等,以及对应互斥锁的 Mutex、RwLock 和 Condvar 等。 不过,这些原语都是对应同步编程模型,基于线程阻塞来实现的。如果在 Future 和 async/await 上下文当中使用,可能会因为阻塞运行时调度而成为 Async Rust 的性能瓶颈。甚至 Rust 官方定义了一条 Lints 规则,提示开发者不...