Vincent Michel added the comment:

I attached the first version of the documentation for 
`run_coroutine_threadsafe`. The `Concurrency and multithreading` section also 
needs to be updated but I could already use some feedback.

Also, I think we should add a `try-except` in the callback function, especially 
since users can set their own task factory. For instance:
  
loop.set_task_factory(lambda loop, coro: i_raise_an_exception)

will cause the future returned by `run_coroutine_threadsafe` to wait forever. 
Instead, we could have:

    except Exception as exc:
        if future.set_running_or_notify_cancel():
            future.set_exception(exc)

inside the callback to notify the future.

----------
keywords: +patch
Added file: http://bugs.python.org/file40689/run_coroutine_threadsafe_doc.patch

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

Reply via email to