Is it possible to detect the thread an event loop is running in?

Technically, you can create a loop in one thread and run it in another.
asyncio doesn’t forbid it strictly but discourages.
I don’t know how many code will be broken we raise this restriction (but pretty sure some people did weird things already).
Maybe we can start with raising a warning though.

The reality is: passing a loop instance between threads brings you to the land where dragons live. It is dangerous but you might survive.

1 Like