Re:Why choose async/await over threads?
by klysm on Monday March 25, 2024 @10:20AM
(#39816674)
I find this has worked well for me when I can easily state what thread pool work gets executed on.
[ Parent
| on HN ]
I think its kotlin's model. The language don't have a default co-routine executor set, you need to provide your own or spawn one with the std. It can be thread-pooled, single thread, or custom one but there isn't a default one set.
If you use single threaded executor, then race condition won't happen. If you choose pooled, then you obviously should realize there can be a race condition. It's all about choice you made.