1 |
On 1/4/21 1:06 AM, Zac Medico wrote: |
2 |
> Like asyncio.get_event_loop(), return the running loop for the |
3 |
> current thread if there is one, and otherwise construct a new |
4 |
> one if needed. This allows the _safe_loop function to become |
5 |
> synonymous with the global_event_loop function. |
6 |
> |
7 |
> Bug: https://bugs.gentoo.org/763339 |
8 |
> Signed-off-by: Zac Medico <zmedico@g.o> |
9 |
> --- |
10 |
> .../util/_eventloop/global_event_loop.py | 28 ++----------------- |
11 |
> lib/portage/util/futures/_asyncio/__init__.py | 22 ++++++++++----- |
12 |
> 2 files changed, 17 insertions(+), 33 deletions(-) |
13 |
|
14 |
For the case of "loop running in non-main thread" of API consumer, this |
15 |
change makes portage compatible with PEP 492 coroutines with async and |
16 |
await syntax. Portage internals can safely begin using async / await |
17 |
syntax instead of compat_coroutine. |
18 |
-- |
19 |
Thanks, |
20 |
Zac |