Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
dvt
on Aug 27, 2025
|
parent
|
context
|
favorite
| on:
Unexpected productivity boost of Rust
Using sync locks in an async environment is a code smell, so the Rust code is bad right off the bat. Just stick with async locks and take the tiny performance hit unless you know exactly what you're doing.
ozgrakkurt
on Aug 27, 2025
|
next
[–]
If I remember correctly tokio Mutex docs mentions you should use std Mutex unless you are holding the lock across an await
pwdisswordfishz
on Aug 27, 2025
|
parent
|
next
[–]
Which is exactly what happens here!
ozgrakkurt
on Aug 28, 2025
|
root
|
parent
|
next
[–]
That section looks like a cut out version of a pseudo code more than actual code.
He could have mem::dropped the lock 50 lines before the await point
bkolobara
on Aug 28, 2025
|
prev
[–]
I didn't need to hold the lock across the .await point and in that case the official docs recommend a regular lock.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: