asyncio
asyncio copied to clipboard
Python: run_soon_threadsafe
Nice Python-like-API-approach. I started something like this some time ago and my event loop class looked pretty much the same.
In Python, you can have multiple event loops:
See https://docs.python.org/3/library/asyncio-eventloop.html call_soon_threadsafe
, set_event_loop
etc.
I think it's about making this a thread_local:
EventLoop& get_event_loop() {
static EventLoop loop;
return loop;
}
The continuation may be a bit different as well. I'd love a combination of this API with the
multithreading-capabilities of https://github.com/David-Haim/concurrencpp
.