This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vxgmichel
Recipients gvanrossum, python-dev, vstinner, vxgmichel, yselivanov
Date 2015-10-04.13:31:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
While I was working on the documentation update, I realized that what we called `run_coroutine_threadsafe` is actually a thread-safe version of `ensure_future`. What about renaming it to `ensure_future_threadsafe`? It might be a bit late since `run_coroutine_threadsafe` has been committed, but I think it is worth to be considered. I can see two benefits:

- it is less confusing, because it has the same name and using the same prototype as `ensure_future`
- it accepts futures and awaitables

The docstring would be "Wrap a coroutine, an awaitable or a future in a concurrent.futures.Future.". The documentation would explain that it works like `ensure_future` except:
1. its execution is threadsafe
2. it provides a thread-safe future instead of a regular future

I attached an implementation of it. Also, note that I added a `try-except` in the callback, which is not mandatory but probably a good thing have.

In any case, I'll keep working on the documentation update.
Date User Action Args
2015-10-04 13:31:10vxgmichelsetrecipients: + vxgmichel, gvanrossum, vstinner, python-dev, yselivanov
2015-10-04 13:31:09vxgmichelsetmessageid: <>
2015-10-04 13:31:09vxgmichellinkissue25304 messages
2015-10-04 13:31:09vxgmichelcreate