This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Ben.Darnell
Recipients Ben.Darnell, Big Stone, asvetlov, carltongibson, lukasz.langa, mikeshardmind, njs, steve.dower, yselivanov
Date 2020-02-25.18:58:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582657095.19.0.0572453593358.issue37373@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-02-25 18:58:15Ben.Darnellsetrecipients: + Ben.Darnell, njs, asvetlov, lukasz.langa, yselivanov, steve.dower, Big Stone, mikeshardmind, carltongibson
2020-02-25 18:58:15Ben.Darnellsetmessageid: <1582657095.19.0.0572453593358.issue37373@roundup.psfhosted.org>
2020-02-25 18:58:15Ben.Darnelllinkissue37373 messages
2020-02-25 18:58:15Ben.Darnellcreate