Re:Python Asyncio: The Complete Guide
by number6 on Thursday November 10, 2022 @01:32PM
(#33550986)
Can you give me an example which languages do this?
[ Parent
| on HN ]
Re:Python Asyncio: The Complete Guide
by matsemann on Thursday November 10, 2022 @01:40PM
(#33551117)
In Kotlin for instance you can run your coroutines with different "dispatchers", which have different behaviors. You can for instance use a dispatcher with multiple threads in a threadpool, run it in the main thread, a specific thread, in threads with low/high priority etc. Basically allowing you to write code using the async/coroutine paradigm, but then control its execution from the outside.
> In Kotlin for instance you can execute your coroutines with different "dispatchers", which have different behaviors. You can for instance use a dispatcher with multiple threads in a threadpool, run it in the main thread, a specific thread, in threads with low/high priority etc. Basically allowing you to write code using the async/coroutine paradigm, but then control its execution from the outside.
I'm not very experienced with Kotlin, but that sounds similar to python's run_in_executor [1]
[1] https://docs.python.org/3/library/asyncio-eventloop.html#asy...
Re:Python Asyncio: The Complete Guide
by throwaway81523 on Monday November 14, 2022 @07:27PM
(#33603507)
Look at seastar.io which is an async concurrency library for C++. It is painful in that it resembles node.js but it is very performant. I'd be interested in seeing a version adapted to use C++20 coroutines.