3 ms·
If you're doing everything sequentially anyway, why bother with the awaiting part? As far as I can see your example would be functionally unchanged if you wrote
by captaincrowbar 13y ago
If you're doing everything sequentially anyway, why bother with the awaiting part? As far as I can see your example would be functionally unchanged if you wrote the same code except without the await keyword.
- scott_s 13y agoBecause it doesn't block the thread. The idea is that this code is executed inside of a thread that, if it blocks, will cause the application to hang. For example, in a GUI or a server. So, if its a thread driving a GUI, and it's blocked on user input, then the entire application interface will be unresponsive until it receives that input.
- danabramov 13y agoThis. Specifically, I'm thinking about iOS prompts and alerts, they are not blocking.
- gruseom 13y agoGreat comment! I missed that.