title: global event loop(main thread) changed by threads in flask app
body: <p>I have four threads executing in order when flask app run.</p>
  <p>and they implements its own event loop, and run_until_complete</p>
  <pre><code>    @staticmethod
      def _target_impl(
          loop: asyncio.BaseEventLoop,
          conn_task: Callable,
          fut: asyncio.Future
      ) -&gt; None:
          try:
              asyncio.set_event_loop(loop)
              loop.run_until_complete(functools.partial(conn_task, fut)())
              if not fut.done():
                  fut.set_result('complete')
          except Exception as err:
              fut.set_exception(err)
  </code></pre>
  <p>this target impls a event loop and connect to a websocket server.</p>
  <p>args:</p>
  <p>loop: main thread created</p>
  <p>fut: a stop waiter create by loop upon</p>
  <p>conn_task: coroutine implements a websocket connection client, stop by set 'fut' done</p>
  <p>my question is:</p>
  <ol>
  <li><p>When I start flask app and start these thread in order. <strong>The first started thread will change MainThread's event loop and keep it running same as its own loop</strong>, meanwhile these four thread running fine. So I can't run async function in my flask view.</p>
  </li>
  <li><p>Then I use ipython to import these thread instance and start in order. there is no running loop in my ipython's main thread.</p>
  </li>
  </ol>