From: Zac Medico <zmedico@gentoo.org>
To: Zac Medico <zmedico@gentoo.org>, gentoo-portage-dev@lists.gentoo.org
Subject: [gentoo-portage-dev] Re: [PATCH] global_event_loop: return running loop for current thread
Date: Mon, 4 Jan 2021 01:34:03 -0800 [thread overview]
Message-ID: <08322855-0474-e137-8ada-9340743561f1@gentoo.org> (raw)
In-Reply-To: <20210104090631.1584444-1-zmedico@gentoo.org>
[-- Attachment #1.1: Type: text/plain, Size: 860 bytes --]
On 1/4/21 1:06 AM, Zac Medico wrote:
> Like asyncio.get_event_loop(), return the running loop for the
> current thread if there is one, and otherwise construct a new
> one if needed. This allows the _safe_loop function to become
> synonymous with the global_event_loop function.
>
> Bug: https://bugs.gentoo.org/763339
> Signed-off-by: Zac Medico <zmedico@gentoo.org>
> ---
> .../util/_eventloop/global_event_loop.py | 28 ++-----------------
> lib/portage/util/futures/_asyncio/__init__.py | 22 ++++++++++-----
> 2 files changed, 17 insertions(+), 33 deletions(-)
For the case of "loop running in non-main thread" of API consumer, this
change makes portage compatible with PEP 492 coroutines with async and
await syntax. Portage internals can safely begin using async / await
syntax instead of compat_coroutine.
--
Thanks,
Zac
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 981 bytes --]
prev parent reply other threads:[~2021-01-04 9:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-04 9:06 [gentoo-portage-dev] [PATCH] global_event_loop: return running loop for current thread Zac Medico
2021-01-04 9:34 ` Zac Medico [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=08322855-0474-e137-8ada-9340743561f1@gentoo.org \
--to=zmedico@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox