Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: Zac Medico <zmedico@g.o>, gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] Re: [PATCH] global_event_loop: return running loop for current thread
Date: Mon, 04 Jan 2021 09:34:07
Message-Id: 08322855-0474-e137-8ada-9340743561f1@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] global_event_loop: return running loop for current thread by Zac Medico
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

Attachments

File name MIME type
signature.asc application/pgp-signature