unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Maxime Devos <maximedevos@telenet.be>
Cc: guix-devel@gnu.org
Subject: Re: The Shepherd on Fibers
Date: Tue, 29 Mar 2022 15:03:11 +0200	[thread overview]
Message-ID: <87lewszzao.fsf@gnu.org> (raw)
In-Reply-To: <0678da36c885da1619164663b4ccf2eaa8226944.camel@telenet.be> (Maxime Devos's message of "Sat, 26 Mar 2022 13:44:40 +0100")

Maxime Devos <maximedevos@telenet.be> skribis:

> Ludovic Courtès schreef op wo 23-03-2022 om 23:36 [+0100]:
> Thoughts?
>
> From service.scm:
>
>> +  (define (sleep* n)
>> +    ;; In general we want to use (@ (fibers) sleep) to yield to the scheduler.
>> +    ;; However, this code might be non-suspendable--e.g., if the user calls
>> +    ;; the 'start' method right from their config file, which is loaded with
>> +    ;; 'primitive-load', which is a continuation barrier.  Thus, this variant
>> +    ;; checks whether it can suspend and picks the right 'sleep'.
>> +    (if (yield-current-task)
>> +        (begin
>> +          (set! sleep* (@ (fibers) sleep))
>> +          (sleep n))
>> +        (begin
>> +          (set! sleep* (@ (guile) sleep))
>> +          ((@ (guile) sleep) n))))
>
> Instead of working around this limitation of Fiber's 'sleep',
> why not modify Fiber's sleep to detect if it is from a suspendable
> context or not, and depending on that, use Guile's sleep/usleep or
> the perform-operation+sleep-operation?

The short answer is that I want to get that done and not rely on an
unreleased version of Fibers.  The hack above uses the public interface;
it’s not pretty, but I think it’s okay.

Longer-term, maybe we could change Fibers’ ‘sleep’ as you suggest.
Whether it’s a good idea is debatable: one could argue that Fibers’
‘sleep’ is meant to be called from a fiber (suspendable).

Ludo’.


  reply	other threads:[~2022-03-29 13:03 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 22:36 The Shepherd on Fibers Ludovic Courtès
2022-03-25 13:29 ` Maxim Cournoyer
2022-03-26 21:28   ` Ludovic Courtès
2022-03-26 11:06 ` pelzflorian (Florian Pelz)
2022-03-26 11:09   ` Zhu Zihao
2022-03-26 11:16     ` Zhu Zihao
2022-03-26 11:18     ` pelzflorian (Florian Pelz)
2022-03-26 11:27       ` Zhu Zihao
2022-03-26 16:56         ` pelzflorian (Florian Pelz)
2022-03-26 11:59   ` Maxime Devos
2022-03-26 16:52     ` pelzflorian (Florian Pelz)
2022-03-26 18:20       ` Maxime Devos
2022-03-29 11:44   ` Ludovic Courtès
2022-03-26 12:03 ` Maxime Devos
2022-03-29 12:47   ` Ludovic Courtès
2022-03-26 12:11 ` Maxime Devos
2022-03-29 12:48   ` Ludovic Courtès
2022-03-29 16:26     ` Maxime Devos
2022-03-30 15:14       ` Ludovic Courtès
2022-03-30 17:16         ` Maxime Devos
2022-03-26 12:16 ` Maxime Devos
2022-03-29 12:50   ` Ludovic Courtès
2022-03-29 12:52     ` Maxime Devos
2022-03-29 12:54     ` Maxime Devos
2022-03-29 15:29       ` Attila Lendvai
2022-03-30 10:05         ` Ludovic Courtès
2022-03-31  4:33         ` adriano
2022-03-31  7:56           ` Attila Lendvai
2022-03-26 12:44 ` Maxime Devos
2022-03-29 13:03   ` Ludovic Courtès [this message]
2022-03-26 19:24 ` Maxime Devos
2022-03-29  0:14 ` Philip McGrath
2022-03-29  0:22   ` Philip McGrath
2022-03-29  9:36   ` Maxime Devos
2022-03-29 11:11     ` Philip McGrath
2022-03-30 10:00       ` Ludovic Courtès
2022-03-29 10:13   ` Zhu Zihao
2022-03-29 10:40     ` Maxime Devos
2022-03-30  9:49   ` Ludovic Courtès
2022-03-29 13:16 ` Ludovic Courtès
  -- strict thread matches above, loose matches on Subject: below --
2022-03-24  6:48 Brendan Tildesley
2022-03-24 16:57 Nathan Dehnel

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=87lewszzao.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=maximedevos@telenet.be \
    /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).