unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 45314@debbugs.gnu.org
Cc: Mathieu Othacehe <othacehe@gnu.org>
Subject: bug#45314: ‘guix discover’ polls
Date: Fri, 18 Dec 2020 18:10:04 +0100	[thread overview]
Message-ID: <87a6ub9h1v.fsf@inria.fr> (raw)

[-- Attachment #1: Type: text/plain, Size: 1408 bytes --]

Hi!

‘guix discover’ polls with 100ms intervals:

--8<---------------cut here---------------start------------->8---
18:00:57 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)
18:00:57 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
18:00:57 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)
18:00:57 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
18:00:57 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)
18:00:57 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
18:00:57 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)
18:00:57 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
18:00:57 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)
18:00:57 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
18:00:57 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)
18:00:57 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
18:00:57 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)
18:00:58 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
18:00:58 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)
--8<---------------cut here---------------end--------------->8---

This comes from ‘avahi-browse-service-thread’ in (guix avahi) and its
100ms #:timeout.

How about the change below?

Thanks,
Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1463 bytes --]

diff --git a/guix/avahi.scm b/guix/avahi.scm
index aa90a5cdd4..132e42f268 100644
--- a/guix/avahi.scm
+++ b/guix/avahi.scm
@@ -89,13 +89,19 @@ when STOP-LOOP? procedure returns true."
     (close-port socket)
     ip))
 
+(define never
+  ;; Never true.
+  (const #f))
+
 (define* (avahi-browse-service-thread proc
                                       #:key
                                       types
                                       (ignore-local? #t)
                                       (family AF_INET)
-                                      (stop-loop? (const #f))
-                                      (timeout 100))
+                                      (stop-loop? never)
+                                      (timeout (if (eq? stop-loop? never)
+                                                   #f
+                                                   100)))
   "Browse services which type is part of the TYPES list, using Avahi.  The
 search is restricted to services with the given FAMILY.  Each time a service
 is found or removed, PROC is called and passed as argument the corresponding
@@ -167,4 +173,6 @@ when STOP-LOOP? procedure returns true."
                               client-callback)))
     (and (client? client)
          (while (not (stop-loop?))
-           (iterate-simple-poll poll timeout)))))
+           (if timeout
+               (iterate-simple-poll poll timeout)
+               (iterate-simple-poll poll))))))

             reply	other threads:[~2020-12-18 17:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18 17:10 Ludovic Courtès [this message]
2020-12-20  9:43 ` bug#45314: ‘guix discover’ polls Mathieu Othacehe

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6ub9h1v.fsf@inria.fr \
    --to=ludo@gnu.org \
    --cc=45314@debbugs.gnu.org \
    --cc=othacehe@gnu.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).