Well correct me if I'm wrong (I did a bit of homework), but threads are hard to get right because they may switch at any time.
When we do async instead of threads, it's because we want task switch on blocking operations only.
The thing that is still not quite clear to me, and really I must apologize because I know you kind people have gone through quite some effort to clarify this for me, and I'm feeling pretty bad enough about it, I don't want to be the vampire of the list, I welcome all criticism on my behaviour even off list, as some of you know, I'm just a script-kiddie that became a script-daddy (don't worry I'm not going to apologize all the time, at least now it's done for this list !), anyway, given that:
- a blocking call is caused by sleeps and io,
- we want blocking calls to cause a task switch,
- await serves to signal the coder of a potential task switch.
A coder *should* know if a function is going to do a sleep or a blocking call, if i'm calling git.push() for example, there's definitely going to be some subprocess, networking, fs work etc. As such, I feel like I'm *already* supposed to know that this implies blocking calls, and that a task switch may occur if calling git.push() in an async job, otherwise would I really be doing a good job at being a developer ?
Some have said that sending people who don't get so much satisfaction (getting some, but not "so much") writing async code to just use threading, wouldn't gevent be the closest alternative to suggest ?
Thanks a heap for all your replies and for keeping the list open,
Have a great Sunday ;)