Ben Darnell <ben.darn...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37373>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to