Re:Why choose async/await over threads?
by zaphar on Monday March 25, 2024 @10:22AM
(#39816707)
That assumes you are using Tokio. As another poster said not only does the ecosystem fragment along the async/non async lines but along the runtime lines. Async is an extremely leaky abstraction. You are in a way making my point for me. If you want to avoid painful refactoring you should basically always start out tokio-async and shim in non async code as needed because going the other way is going to hurt.
[ Parent
| on HN ]
`spawn_blocking` is a single function and it is not complicated, it shouldn't be too hard for other runtimes to do the same.
The end application does have to choose a runtime anyway and will have to stick with it because this area isn't standardized yet. This problem mostly affects the part of the ecosystem that wants to put complicated concurrency logic into libraries.
Re:Why choose async/await over threads?
by cryptonector on Monday March 25, 2024 @11:22AM
(#39817454)
`spawn_blocking` should be part of a core executor interface that all executors must provide.