←back to thread

159 points mpweiher | 1 comments | | HN request time: 0.202s | source
Show context
anarki8 ◴[] No.43672225[source]
I find myself using channels in async Rust more than any other sync primitives. No more deadlock headaches. Easy to combine multiple channels in one state-keeping loop using combinators. And the dead goroutines problem described in the article doesn't exist in Rust.
replies(5): >>43672313 #>>43672959 #>>43674608 #>>43674871 #>>43675417 #
j-krieger ◴[] No.43674608[source]
I haven't yet used channels anywhere in Rust, but my frustration with async mutexes is growing stronger. Do you care to show any examples?
replies(1): >>43686841 #
1. tcfhgj ◴[] No.43686841[source]
async mutexes?

> Contrary to popular belief, it is ok and often preferred to use the ordinary Mutex from the standard library in asynchronous code.

> The feature that the async mutex offers over the blocking mutex is the ability to keep it locked across an .await point.

https://docs.rs/tokio/latest/tokio/sync/struct.Mutex.html