Yury Selivanov added the comment:

> Thread may have multiple event loops, but only one, explicitly associated, is 
> default. And it's not necessary one which is currently running.

Ah, I got it.  You know what, this actually is starting to make sense.

Guido, what do you think about this?  Essentially, (Ilya, feel free to correct 
me if I'm wrong), we can implement the following:

1. Add a new thread-local storage, say "_running_loop"

2. Add another method "asyncio.get_running_loop()"

3. Update some places in asyncio where we currently use "get_event_loop()", 
such as Future constructor, Task.current_task, etc.

This might actually solve an awkwardness of get_event_loop(), which when 
called, instantiates an event loop if it doesn't find one, which makes it 
difficult to know if an event loop was running before the call.

----------

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

Reply via email to