all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: 宋文武 <iyzsong@member.fsf.org>
Cc: guix-devel@gnu.org
Subject: Re: [WIP][PATCH] download: Don't report the progress too fast
Date: Sun, 10 Sep 2017 23:25:08 +0200	[thread overview]
Message-ID: <877ex6456z.fsf@gnu.org> (raw)
In-Reply-To: <87mv652phq.fsf@member.fsf.org> ("宋文武"'s message of "Fri, 08 Sep 2017 23:12:49 +0800")

Hi!

iyzsong@member.fsf.org (宋文武) skribis:

> Hi, sorry for my late response.

No problem, it was worth waiting.  ;-)

> ludo@gnu.org (Ludovic Courtès) writes:

[...]

>> (Also, longer-term, we’d want to do that other way around, which is to
>> update the report every N milliseconds, as opposed to just printing
>> something when a chunk has been transferred.)
>>
>
> Yes, so the elapsed time won't be freezed, and here is my try using
> thread:

[...]

> From 4036ce5de7bf3b98327010bbfbf75029f3d0b572 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@member.fsf.org>
> Date: Fri, 8 Sep 2017 22:49:03 +0800
> Subject: [PATCH] download: Report the progress asynchronously in another
>  thread.
>
> * guix/utils.scm (<progress-reporter>): New record type.
> (call-with-progress-reporter): New procedure.
> * guix/build/download.scm (dump-port*, progress-reporter/file): New
> procedures.
> (ftp-fetch, http-fetch): Use them.
> (progress-proc): Remove procedure.
> * guix/scripts/substitute.scm (progress-report-port): Rewrite in terms of
> <progress-reporter>.
> (process-substitution): Adjust accordingly.

Impressive!

I have a couple of concerns though:

  1. Using a thread “just” for progress reporting seems quite
     heavyweight, though maybe that’s OK.

  2. As per POSIX, we cannot mix ‘fork’ and threads, so programs that
     use ‘primitive-fork’ should not also use threads.  One such program
     is (guix scripts substitute), via ‘decompressed-port’.  Guile
     rightfully emits a warning when a multithreaded program calls
     ‘primitive-fork’:

       https://git.savannah.gnu.org/cgit/guile.git/tree/libguile/posix.c#n1224

   3. “Atomic boxes” are a Guile 2.2 feature, but we still support 2.0.

To address these, I would use ‘abort-to-prompt’ & co., possibly with
“suspendable ports”, but this is a 2.2 feature.  (It may be that we
should use Fibers directly.)

Tricky!  Not sure what to do here.

Thoughts?

Ludo’.

  reply	other threads:[~2017-09-10 21:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-26 10:51 [WIP][PATCH] download: Don't report the progress too fast 宋文武
2017-08-30  8:45 ` Ludovic Courtès
2017-09-08 15:12   ` 宋文武
2017-09-10 21:25     ` Ludovic Courtès [this message]
2017-09-14 14:20       ` 宋文武
2017-09-16  6:27         ` 宋文武
2017-09-19 11:34           ` Ludovic Courtès
2017-09-20 12:04             ` 宋文武
2017-09-19 11:32         ` Ludovic Courtès

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=877ex6456z.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=iyzsong@member.fsf.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 external index

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

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.