Sujet : Re: Threads across programming languages
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.c++ comp.lang.cDate : 29. Apr 2024, 21:36:57
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v0p0d9$1ur12$6@dont-email.me>
References : 1
User-Agent : Pan/0.155 (Kherson; fc5a80b8)
On 29 Apr 2024 15:19:19 GMT, Stefan Ram wrote:
With asyncio, however, you can easily handle the application for
threads to "wait in parallel" for thousands of sockets in a single
thread, and there are fewer opportunities for errors than with
multithreading.
It makes event-loop programming much more convenient. I posted a
simple example here from some years ago
<
https://github.com/HamPUG/meetings/tree/master/2017/2017-05-08/ldo-generators-coroutines-asyncio>:
compare the version based on callbacks, with the one using asyncio:
the former is about 30% bigger.