(coro, loop)
return future
Submit a coroutine object to a given event loop.

    Return a concurrent.futures.Future to access the result.
Submit a coroutine object to a given event loop.
Submit a coroutine object to a given event loop .
def run_coroutine_threadsafe(coro, loop):
    """Submit a coroutine object to a given event loop.

    Return a concurrent.futures.Future to access the result.
    """
    if not coroutines.iscoroutine(coro):
        raise TypeError('A coroutine object is required')
    future = concurrent.futures.Future()

    def callback():
        try:
            futures._chain_future(ensure_future(coro, loop=loop), future)
        except (SystemExit, KeyboardInterrupt):
            raise
        except BaseException as exc:
            if future.set_running_or_notify_cancel():
                future.set_exception(exc)
            raise

    loop.call_soon_threadsafe(callback)
    return future
def run_coroutine_threadsafe ( coro , loop ) : if not coroutines . iscoroutine ( coro ) : raise TypeError ( 'A coroutine object is required' ) future = concurrent . futures . Future ( ) def callback ( ) : try : futures . _chain_future ( ensure_future ( coro , loop = loop ) , future ) except ( SystemExit , KeyboardInterrupt ) : raise except BaseException as exc : if future . set_running_or_notify_cancel ( ) : future . set_exception ( exc ) raise loop . call_soon_threadsafe ( callback ) return future