bytedance / monoio

Rust async runtime based on io-uring.
Apache License 2.0
4.02k stars 226 forks source link

Async RwLock and Mutex. #298

Open weisrc opened 2 months ago

weisrc commented 2 months ago

The local sync library doesn't have an async RwLock and Mutex.

ihciah commented 2 months ago

Async RwLock and Mutex do not depend on async runtime. You can use any implementation. I think it's better to provide them in third-party libraries. Note: if you want these mutex work under monoio, please enable sync feature, since these mutex require futures be able to woken from another thread.

weisrc commented 2 months ago

Ok, thanks. So I can use Tokio's Async RwLock and Mutex safely with Monoio?

ihciah commented 2 months ago

So I can use Tokio's Async RwLock and Mutex safely with Monoio?

Yes. You can also use its channel implementation, or third-party crates like async-channel.