From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Chris Vine Newsgroups: gmane.lisp.guile.user Subject: Re: Question about an error with ports Date: Fri, 11 Mar 2022 17:26:50 +0000 Message-ID: <20220311172650.aeab7bf504b38992196e0141@gmail.com> References: <3f938fe1-9af4-9076-8d50-d1f7b2ddda36@posteo.de> <87ilslc0gn.fsf@laura> <87fsnpbcbp.fsf@laura> <20220311120500.ad94ea6ad79068dc1f8ff85d@gmail.com> <87czisbkng.fsf@laura> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31114"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Mar 11 18:27:56 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nSj3T-0007qG-S3 for guile-user@m.gmane-mx.org; Fri, 11 Mar 2022 18:27:55 +0100 Original-Received: from localhost ([::1]:59698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nSj3S-0000HN-JL for guile-user@m.gmane-mx.org; Fri, 11 Mar 2022 12:27:54 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSj2d-0007zJ-NM for guile-user@gnu.org; Fri, 11 Mar 2022 12:27:03 -0500 Original-Received: from [2a00:1450:4864:20::32b] (port=53058 helo=mail-wm1-x32b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nSj2c-0001dS-3n for guile-user@gnu.org; Fri, 11 Mar 2022 12:27:03 -0500 Original-Received: by mail-wm1-x32b.google.com with SMTP id r65so5522334wma.2 for ; Fri, 11 Mar 2022 09:27:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=bTL/ZVMYMWcumgd9TfPLC4TJr+9UyEtf3jHH7ukmGLI=; b=aS9kZEoEaUL0zGh/zVMgxxWobAlwhC8j3NfEKfDi4nPpSFLiyRsTarkYcHnxP/2rqL XIcgzEBWSHAy5vCBwZN0W9UU0Qjc246+V1CDlBdeZyYNHXvBYiqEnN7jJgLqbvOQCwxt wzFnr9oyZVfUaDptqMLM2HDxxEHNDtBYqDZAJq9M15HgfNm08Kf+vBSgCL4PxYosOGlg ZDXeotGddxGRARRjaj8dLR1GHJ3feFTeb2pkUFRWFrayY/GUM7JihJVC7NWPqR6b8rRk zV078brR/qspzhsxup1NqE48lwRvCwCfcZhJbMSVsz6oSmqxmn23RnEv6o/gl+q690Gf zdfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bTL/ZVMYMWcumgd9TfPLC4TJr+9UyEtf3jHH7ukmGLI=; b=fPOnE719DTAniBECzPRaTSYTWN3BV7hEVi0TieSzggV2CTE2qgdj86e1YoH9WOqCUZ tnulcWEVq2W8z/hdySAkyOvsqZqVEexxHM90XplnwAkkaxK7C/fWoGDjVyUX5FURX02L MoFBuhm761XLZLIGv7TB7M74uPnALywb7YVcEvO6Cv2N+j80FREVvnGIT1f08SBb2lXs ZlVAgj8KrEZOnWSL+Zx+LvJKMfcj7m283TgicO1RIW17BOYrbejkpEhf8Lkocau+KudP c9C9zTfufepJbtIwSmeJ6HUYshuhdBWq9aOXPKg22XgVtFo4m7x49MFt0qpaDbT/rjd0 n0nA== X-Gm-Message-State: AOAM5313pTPxBFAKQgfEG8NCxamx6jDQSf+H/xseNPj1BGyag6A4J/j3 hK40R6NbZCb+zu8R3O3rAmzh1R9LqoY= X-Google-Smtp-Source: ABdhPJzL0bWA1GwyH1mKFPp5smQIfY2PzryFChbEGaMg9DUd0Yg+JMj9g0fkoevsolVUM3bc0Hne/Q== X-Received: by 2002:a05:600c:3ba8:b0:389:bc0c:c1b2 with SMTP id n40-20020a05600c3ba800b00389bc0cc1b2mr16108698wms.136.1647019619734; Fri, 11 Mar 2022 09:26:59 -0800 (PST) Original-Received: from dell.homenet (253.253.9.51.dyn.plus.net. [51.9.253.253]) by smtp.gmail.com with ESMTPSA id s17-20020adfdb11000000b001f02d5fea43sm7850121wri.98.2022.03.11.09.26.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 09:26:59 -0800 (PST) Original-Received: from dell.homenet (localhost [127.0.0.1]) by dell.homenet (Postfix) with SMTP id 904A0427963 for ; Fri, 11 Mar 2022 17:26:50 +0000 (GMT) In-Reply-To: <87czisbkng.fsf@laura> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-unknown-linux-gnu) X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32b (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=vine24683579@gmail.com; helo=mail-wm1-x32b.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:18187 Archived-At: On Fri, 11 Mar 2022 09:58:59 -0500 Olivier Dion wrote: > On Fri, 11 Mar 2022, Chris Vine wrote: [snip] > > Avoid using get-bytevector-n!, get-bytevector-some and > > get-bytevector-all if you are going to use something like fibers or > > some other asynchronous i/o, as those procedures are not suspendable > > (they can block). get-bytevector-n (note the difference from > > get-bytevector-n!) and get-string-all are suspendable and should > > generally be preferred where suspension is required. > > I'm not sure this is related to the functions themself but instead the > underlying filedescriptor opened iwth ON_NONBLOCK? The problem I am referring to is different: it is that delimited continuations cannot capture C code and ports are written in C. Suspendable specializations, written in pure scheme, of some of guile's i/o procedures are therefore provided in modules/ice-9/suspendable-ports.scm, which is a file worth reading on its own account, and which are brought into effect (by suppressing the C-based equivalents) by applying the install-suspendable-ports! procedure. If your i/o steps out of this set of primitives (see in particular the port-bindings variable in that file) then it is not suspendable. When suspendable ports were first introduced in guile-2.2.0, this safe set did not include get-bytevector-n!, get-bytevector-some, get-bytevector-some! and get-bytevector-all: I have just re-read the code in guile-2.2.0 to confirm this. I have also just checked with the latest versions of guile-2.2 and guile-3.0 and it appears that get-bytevector-n!, get-bytevector-some and get-bytevector-some! are now supported so it looks as if at some point since version 2.2.0 they have become OK. With guile-2.2.0, this in turn meant that amongst other things, http-get, http-put and so on could not normally be used in suspendable code. I would need to check whether that remains the case - I cannot now remember which calls they made which were forbidden to suspendable code. Notable procedures which it appears remain as non-suspendable are get-bytevector-all, get-string-n, read, write and display, but to be sure about the first two of those I would also need to read the source again. A few years ago I had some test code to test which procedures were suspendable and I will also have to see if I can find it again. Chris