4 ms·
If you don't have async markings, you can't know where in your code you have concurrency and this would require you to use synchronization primitives. For share
by zzzcpan 7y ago
If you don't have async markings, you can't know where in your code you have concurrency and this would require you to use synchronization primitives. For shared memory languages this means all that error-prone shared memory multithreading, like in Go [1].
[1] https://songlh.github.io/paper/go-study.pdf https://songlh.github.io/paper/go-study.pdf
- atombender 7y agoBut a synchronous Rust function can still do threading, which makes your point moot.
- zzzcpan 7y agoIt's not moot, there is no point to do threading from within asynchronous programming primitives.
- atombender 7y agoYour original comment implies that "async"-marked functions are the only functions that have concurrency ("If you don't have async markings, you can't know where in your code you have concurrency"), which isn't true. You can have threading in any function. So marking a function async makes no difference.
- zzzcpan 7y agoNo, think of it as a convention or a framework. While it's ok to wait for asynchronous code to finish in your synchronous code, it's not ok to do threading from within your asynchronous primitives, so you wouldn't need threading synchronization primitives.