Replies: 2 comments 4 replies
-
|
It's exciting watching you work through these issues as a first timer to this sort of problem. It really illustrates to me the power of Rust: you're solving some extremely hard and risky problems in a way that's going to be safe at runtime. Even though you're definitely struggling to learn the concepts and make the compiler happy, the program you're producing at the end is going to be sound. That makes all that struggle good struggle, because it teaches you and helps you be a better programmer that understands threading better, without risking terrible results in something you've built. |
Beta Was this translation helpful? Give feedback.
-
|
Stumbled across this series as a fellow FastAPI fan exploring Rust alternatives and thoroughly enjoying it, thank you. Rocket 0.5 has, at last, been fully released as of a couple weeks ago - have you had an opportunity to tinker with it yet and see how it feels compared to the release candidate? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This discussion thread is a place for you to leave your questions, comments, suggestions, and emoji reactions to this blog post. It's also a great place to leave ideas about what you'd like to see in the rest of this series!
The blog post talks about using
parking_lot::Mutexto solve the issue of mutating shared data. Bothparking_lot::Mutexandstd::sync::Mutexare dangerous in async contexts because they're blocking and can cause deadlocks! Consider this situation:.awaitand yields control to the runtime..await. Future 1 will never finish working and drop the Mutex guard, so the Mutex will never unlock.The solution, already implemented in my fork of
rocket_lamb, is to usetokio::Mutexinstead. The.lock()function there is a Future which can be.awaited.Beta Was this translation helpful? Give feedback.
All reactions