Message252267
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:10 | vxgmichel | set | recipients:
+ vxgmichel, gvanrossum, vstinner, python-dev, yselivanov |
2015-10-04 13:31:09 | vxgmichel | set | messageid: <1443965469.97.0.481952038235.issue25304@psf.upfronthosting.co.za> |
2015-10-04 13:31:09 | vxgmichel | link | issue25304 messages |
2015-10-04 13:31:09 | vxgmichel | create | |
|