From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Chris Vine Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Add current-suspendable-io-status parameter Date: Wed, 15 May 2019 12:25:05 +0100 Message-ID: <20190515122505.0e8d57a2cf1e5f4d0962e31c@gmail.com> References: <20190515100919.GG32396@tuxteam.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="73458"; mail-complaints-to="usenet@blaine.gmane.org" To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed May 15 13:25:18 2019 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hQs2A-000J0E-B5 for guile-devel@m.gmane.org; Wed, 15 May 2019 13:25:18 +0200 Original-Received: from localhost ([127.0.0.1]:35439 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQs29-0005o3-Ar for guile-devel@m.gmane.org; Wed, 15 May 2019 07:25:17 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQs24-0005mt-Lo for guile-devel@gnu.org; Wed, 15 May 2019 07:25:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQs23-0005Bf-JZ for guile-devel@gnu.org; Wed, 15 May 2019 07:25:12 -0400 Original-Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:39121) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQs23-00056n-Cr for guile-devel@gnu.org; Wed, 15 May 2019 07:25:11 -0400 Original-Received: by mail-wm1-x344.google.com with SMTP id n25so2087609wmk.4 for ; Wed, 15 May 2019 04:25:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=vQ8H5ObtzcqJcaWPKYDaDKxyFcBdTZ1JskkdQt1/8L4=; b=ecLdKRLioWVtQQhTphyck4BQeeIXMvxyLRCLsiB41kbQd993OR7OsRWYqi7kc05rqa xz/opV7V16qwBXuK4Zm2p7VzZr1LvLKwaGv8u4IuVKVHkUhuxuuGmhkpanb97NeOZT4X NNctmZ4UpfpdHcAdsB48OvsZC1FJa1uq9sYQ+MAfvMTiO0eiP1kqhS0Qi+xH+F2IOLOs YvJoh5+VwKcW3OrNK/s9BLdTTbwICq2b9xG2RTXVq9M/wKZjGosgXlgq0B/QFISAEnIf QPvn8zZEIW/17+lQMRaCJ2Q2V5aH1HBO5UuT+axLdRORh3wTmoiOJhXFtwXJ+BsGIujL KYJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vQ8H5ObtzcqJcaWPKYDaDKxyFcBdTZ1JskkdQt1/8L4=; b=LE8SEFHcwHLbGuOJL21/Jn6vEOiZJ9iBjUwx9kepaS8hzvCXRV7yUQ9po7VxoJPmoP 6TeKGMN9cqLeHWGQOa5htfWXP9Yjx17g0G35wGO+fAKJU681eP1VhSX52MSN4MUFM0UP vWo9wjPWTbuTLuFhBPMQfN0CqlWC0AZksrRsTnyIoNUGsOTX4Lszm1My16Pf5USqGFj8 T0aPtU7bLAedjcNhddXJVW2UVdThams/G4X4Axg8QMuwnpxwy6TmxA0ROlXYynBsDjXm ARAjGYO3hHC8GtF0zNR4EF/fNVZHfBQF8r/Zj92Ynsw/im80gR+wL49HpbJDmJ7RpYsq Ymgg== X-Gm-Message-State: APjAAAUCwYy/1YXbiPEaJBCL3xgqZUz5bx+EjyteyPNgNMKE3rrefnK+ BHy81Bz+u0L5LXiqJarF3JwXMMVi X-Google-Smtp-Source: APXvYqw5dgAa/MsFebt13jM1xH6ZGJfpb8aCaKR1xEZep+/soIuJwecHMp2va7rKWYUNDFFbc+d1cQ== X-Received: by 2002:a1c:4843:: with SMTP id v64mr18236150wma.73.1557919508427; Wed, 15 May 2019 04:25:08 -0700 (PDT) Original-Received: from bother.homenet ([2002:5f92:6e5c:10:31ea:f8f0:ad82:f02d]) by smtp.gmail.com with ESMTPSA id j17sm1220738wrs.77.2019.05.15.04.25.06 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2019 04:25:07 -0700 (PDT) Original-Received: from bother.homenet (localhost [127.0.0.1]) by bother.homenet (Postfix) with SMTP id DD127261789 for ; Wed, 15 May 2019 12:25:05 +0100 (BST) In-Reply-To: <20190515100919.GG32396@tuxteam.de> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:19917 Archived-At: On Wed, 15 May 2019 12:09:19 +0200 wrote: > On Mon, May 13, 2019 at 06:54:38PM +0800, Nala Ginrut wrote: > > Hi folks! > > Here's a patch to add current-suspendable-io-status: > > Its result is a pair: (finished-bytes . rest-bytes) > > Sorry for this possibly dumb question, but... is there a way > to be non-blocking even if there are no readable/writable > bytes at all? Or would one have to do multi-threading (and > let the single threads [1] block) for that? > > Thanks With guile-2.2/3.0, you install suspendable ports and parameterize current-read-waiter and/or current-write-waiter. There is an example here: https://github.com/ChrisVine/guile-a-sync2/blob/master/a-sync/await-ports.scm fibers does something similar. See also https://www.gnu.org/software/guile/docs/master/guile.html/Non_002dBlocking-I_002fO.html#Non_002dBlocking-I_002fO Chris