From: Jakub Kicinski <kuba@kernel.org>
To: Donald Hunter <donald.hunter@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Xiao Liang <shaw.leon@gmail.com>, Jiri Pirko <jiri@resnulli.us>,
donald.hunter@redhat.com
Subject: Re: [PATCH net-next v2 2/2] tools/net/ynl: add async notification handling
Date: Tue, 12 Nov 2024 17:38:43 -0800 [thread overview]
Message-ID: <20241112173843.2831e918@kernel.org> (raw)
In-Reply-To: <20241112111727.91575-3-donald.hunter@gmail.com>
some comments for your consideration, if you prefer to keep as is:
Acked-by: Jakub Kicinski <kuba@kernel.org>
On Tue, 12 Nov 2024 11:17:27 +0000 Donald Hunter wrote:
> + def poll_ntf(self, duration=None):
> + endtime = time.time() + duration if duration is not None else None
we can record starttime here, and avoid the complex logic..
> + selector = selectors.DefaultSelector()
> + selector.register(self.sock, selectors.EVENT_READ)
> +
> + while True:
> + try:
> + yield self.async_msg_queue.get_nowait()
> + except queue.Empty:
> + if endtime is not None:
> + interval = endtime - time.time()
then here:
if duration is not None:
timeout = time.time() - starttime + duration
and rest as is (modulo the s/interval/timeout/)
> + if interval <= 0:
> + return
> + else:
> + interval = None
> + events = selector.select(interval)
> + if events:
> + self.check_ntf()
next prev parent reply other threads:[~2024-11-13 1:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-12 11:17 [PATCH net-next v2 0/2] tools/net/ynl: rework async notification handling Donald Hunter
2024-11-12 11:17 ` [PATCH net-next v2 1/2] Revert "tools/net/ynl: improve async notification handling" Donald Hunter
2024-11-12 11:17 ` [PATCH net-next v2 2/2] tools/net/ynl: add async notification handling Donald Hunter
2024-11-13 1:38 ` Jakub Kicinski [this message]
2024-11-13 8:48 ` Donald Hunter
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=20241112173843.2831e918@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=donald.hunter@redhat.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shaw.leon@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.