Implement a runtime-agnostic async mpsc channel based on std's mpsc

⚓ rust    📅 2025-05-31    👤 surdeus    👁️ 2      

surdeus

I'm doing my practice to implement runtime-agnotisc async primitives that are used in our applications and see if it contributes to the ecosystem.

After reading current implements, like tokio's, future-channel's, flume's and async-channel's, I realized that we may directly make use of std's mpsc channel. This actually follows how future-channel does, while it reimplements a sync mpsc channel based on this blog.

The performance of my patch above seems not significantly regress (or even better in some cases). Actually, flume uses a channel state lock at the very beginning and still states its good performance.

Welcome to drop your reviews and comments if there is any ceveat or performance consideration.

2 posts - 2 participants

Read full topic

🏷️ rust_feed