RE: https://floss.social/@janriemer/117322273618651937
People talking about concurrency, parallelism, and async as if it's some mystical shit like Quantum Deadlocks or Schrödinger's stack trace or something.
What do you mean "sync-over-async"? From any perspective in most software there's multiple levels of concurrency/async/parallelism, why are we talking about this as if it's mystical wizardry?
Some people: "Eww, #Async #Rust is so complicated! I have to use `block_on` when I want to wrap async in sync!? Come on!"
C#: 😳 😶🌫️
Synchronous wrappers for #asynchronous methods:
https://learn.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/synchronous-wrappers-for-asynchronous-methods
"This "sync-over-async" pattern can seem straightforward, but it's a common source of deadlocks and performance problems."
The gist is: in C#, it can _deadlock_ in a lot of different scenarios:
- when you are in a single-threaded context
- after thread pool exhaustion
1/?
@tesla Well, because there are a lot of _nuance_ and skill when it comes to this!
Try calling `block_on` in an async context in Rust (with the tokio runtime) and see what happens.
It's not that easy and languages differ greatly in their way of implementing async (the linked post is just _one_ example)!