From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id EGyoK7ADQ2LETQEAgWs5BA (envelope-from ) for ; Tue, 29 Mar 2022 15:03:44 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 2HsoKbADQ2JdPQEA9RJhRA (envelope-from ) for ; Tue, 29 Mar 2022 15:03:44 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5311BA31A for ; Tue, 29 Mar 2022 15:03:44 +0200 (CEST) Received: from localhost ([::1]:45324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZBVf-00087D-De for larch@yhetil.org; Tue, 29 Mar 2022 09:03:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZBVC-00084q-1h for guix-devel@gnu.org; Tue, 29 Mar 2022 09:03:14 -0400 Received: from [2001:470:142:3::e] (port=35098 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZBVB-00083l-BL; Tue, 29 Mar 2022 09:03:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=6F4hdieXw9c1qHpDJgdmMJy9DjTJ+ByR5uas/uQZnYg=; b=nTleL2P589P9FvhWaPdO onoMm0soSdcHWQcvDbY1tjn+oClDcsdghq52x1abH+Zl5MPedzQoLny9OyEcthXh00mn5trX5rpGH HhgWZbnpNYwsiXpeyGrqV56wCJrYIw62fbOAtggoxa8/5ibEjIYKMCLoEu1OHW60hll/8SQBs9rJO cLpDgE8ibQpNG7Mdhy0SANCz1gnH6A6oXd3JH0dEP8aSj4kgVva1hz3+bEdFm1AZD/3nLiSLOIPZv 6XR8zxZEAmZrTfTtfhmRcnOhE+UDwFSLBfw/lNkZmtQ0lY3NM7gygbXL2wCgdRa/o7QHaK+6AsTLT J0AF/5JkwE/WBg==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=38690 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZBVA-0001CX-VC; Tue, 29 Mar 2022 09:03:13 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxime Devos Subject: Re: The Shepherd on Fibers References: <87ee2sfg9d.fsf@inria.fr> <0678da36c885da1619164663b4ccf2eaa8226944.camel@telenet.be> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 9 Germinal an 230 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 29 Mar 2022 15:03:11 +0200 In-Reply-To: <0678da36c885da1619164663b4ccf2eaa8226944.camel@telenet.be> (Maxime Devos's message of "Sat, 26 Mar 2022 13:44:40 +0100") Message-ID: <87lewszzao.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1648559024; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=6F4hdieXw9c1qHpDJgdmMJy9DjTJ+ByR5uas/uQZnYg=; b=QfYF/ibKHpZHWW8Si20mui8DMYAc4NeAT14UhecqbZsxpqBW2wiWEW1k2nTgAWSgWdmOdZ /hYFRq40HKy/I7LZuHN1XiNPhJ4NeP4+4MkkSB2f7U2yuYPIEbZdkn4gePTTjzbk3ErsIg uaRNGdOCsQvkwEnNemGIojHe03nb4V7NAMulbB16WIbe8/bts3E6T+FE1lkIkjCTc3eG+8 XcuJ18M7L8+wPLnlRwBHKWekIA1DFTThsinmyMowHTqwVACWznoejsbdvSJ2Uc2QhDwGZS 3wf94Zzl9nkt3c64zzo717GObDfAADUFfGlweJlvpIKU9UCaet2gMuTtafb/fw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1648559024; a=rsa-sha256; cv=none; b=k2s+h3QozT0LzkhGA7ugwr0WMV/mCJ6ZP6ybfouJirnKmv0KfhDEMVCtgj/G/AdwXl/XHz AK2airRuulrphFUOKhcV8+ZKZlLjQTXkODcYwHfy7EbNsv92zpl7L4k7ezGRJZbNxm9CLs Jq22CI4Z9NVBL6vnnExfSKxB/vqydi0aSKrFHebajyNR9iaNFGYsTNXmfz4/16zPmg5zpq ZKVdOjuto7TIzKCC2EgAVl4PJEbsHZ4RdgcHGMBZM8xVnZQujfJl0lehWjbfX0JJq4caWm +LB0aPFuh1xjGfnqIJjV94pGYapq6e13gyEMAlpfscEaPi1kJm2NMBq1X7AZIw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b=nTleL2P5; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.27 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b=nTleL2P5; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 5311BA31A X-Spam-Score: -5.27 X-Migadu-Scanner: scn1.migadu.com X-TUID: RBrwMHGkdG/6 Maxime Devos skribis: > Ludovic Court=C3=A8s 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 sch= eduler. >> + ;; However, this code might be non-suspendable--e.g., if the user c= alls >> + ;; the 'start' method right from their config file, which is loaded= with >> + ;; 'primitive-load', which is a continuation barrier. Thus, this v= ariant >> + ;; 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=E2=80=99s not pretty, but I think it=E2=80=99s okay. Longer-term, maybe we could change Fibers=E2=80=99 =E2=80=98sleep=E2=80=99 = as you suggest. Whether it=E2=80=99s a good idea is debatable: one could argue that Fibers= =E2=80=99 =E2=80=98sleep=E2=80=99 is meant to be called from a fiber (suspendable). Ludo=E2=80=99.