Message362658
I considered using the `selectors` module directly, but it's not as simple as it sounds. Using the low-level interface means you need to also use a self-waker-pipe (or socket on windows) and manage a queue analogous to that used by `call_soon_threadsafe`. We already have two implementations of this pattern in asyncio with subtle differences between them (such as this one i just found: https://bugs.python.org/issue39651). In the end you'd have to duplicate a non-trivial portion of SelectorEventLoop.
While there might be some efficiency gains to be had by working directly with the lower-level interface (and avoiding some redundancies between the two threads' event loops), I think the most robust/safest option is to use the well-tested SelectorEventLoop so that the only new code is what's needed to pass things back and forth between threads. |
|
Date |
User |
Action |
Args |
2020-02-25 18:58:15 | Ben.Darnell | set | recipients:
+ Ben.Darnell, njs, asvetlov, lukasz.langa, yselivanov, steve.dower, Big Stone, mikeshardmind, carltongibson |
2020-02-25 18:58:15 | Ben.Darnell | set | messageid: <1582657095.19.0.0572453593358.issue37373@roundup.psfhosted.org> |
2020-02-25 18:58:15 | Ben.Darnell | link | issue37373 messages |
2020-02-25 18:58:15 | Ben.Darnell | create | |
|