From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thibaut Verron Newsgroups: gmane.emacs.help Subject: Re: unwind-protect and inhibit-quit Date: Fri, 16 Jul 2021 22:01:33 +0200 Message-ID: References: <875yxbr4lr.fsf@sperrhaken.name> <83eeby680s.fsf@gnu.org> Reply-To: thibaut.verron@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18756"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 16 22:02:24 2021 Return-path: Envelope-to: geh-help-gnu-emacs@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 1m4U2S-0004ki-1E for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 16 Jul 2021 22:02:24 +0200 Original-Received: from localhost ([::1]:58052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4U2Q-00014Z-Vw for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 16 Jul 2021 16:02:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4U1s-00014R-Ge for help-gnu-emacs@gnu.org; Fri, 16 Jul 2021 16:01:48 -0400 Original-Received: from mail-yb1-xb34.google.com ([2607:f8b0:4864:20::b34]:34639) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4U1r-0006j1-3C for help-gnu-emacs@gnu.org; Fri, 16 Jul 2021 16:01:48 -0400 Original-Received: by mail-yb1-xb34.google.com with SMTP id y38so16754234ybi.1 for ; Fri, 16 Jul 2021 13:01:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=HDed5vgBdn3XNpHdOOkgJoKy7KKQoxp7zxNdsdSZcZI=; b=uJ4FU+TyvcRji3vl5Ve/O+tNIVTVITXvfVT7vWBTK9roqPHBD17TxIlllOuWsCkKFh Ck2WTu7BDAw0QGwZIwYVZOUn6tqYQqGXAtqMNHTAri48as9ZKfNGFe9T5rmShetkvnw0 okQ/g4QwNisX6D/uougPZl0ZgTy7FkCCYceexNZYWzCNa7OQUoyKJ+RChAwHTtgiPBGz LqHuS11cn2j9L6nc+rryEAXZSOE6vQ0y58Baaa6uxJioXnroYvhRwCIcYxedL4qu+SEn WDkcjFI5deh8FofJQQEkgaG1Xf3JxgAnA+54cZw2w743Q1pvBNbTcF3iRRofoBVt61Ye V3Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=HDed5vgBdn3XNpHdOOkgJoKy7KKQoxp7zxNdsdSZcZI=; b=NVYumuc3kn+ji2ptDLffuuTEs0XCG218S4F5hJvifmYN/j0nExe49Hg8+AdHJ5GOjI IMB1wlkHsknE2Vx+URSiB7mS2DD/cpw8DrP471VhcW2t8u+XZrU27L4ubx6U9xrQ0cma hCqg1O/y5FNWP5PKsu+xyQbeUbhRI8q+lrwzfgqouLOlyw11RKBTdM/IKRzhiQTP0rqN sfNyus34yq58hVNxnmOHdh+ictd7G7JQDh8mwMkLHDvAjxNOXBJMnNdoOM2eM8daBVe/ w1E/Vr6v2N0KDsIjUuM0AJv7bbfjx7xB0XH7x+n17BIqhjVAfQe1325xP4ox+EBP9Krg e9ig== X-Gm-Message-State: AOAM532UZgk7o6B7NOUB6lVjhtQkH3E2Iy8K7bnWMyAZbB3hq3txGx6D 2SKFF8VOaptCPtahh/qzIqzyLiuciwFGzy2Aw3Y= X-Google-Smtp-Source: ABdhPJzNIK+R8fffM8zJpF7FKv5X4y7u3OyaZoGvto5/Q7uatF6qymCVKElFStZgAFt4JBYeXuvHOS4gF+Xrdo7g1qk= X-Received: by 2002:a25:d296:: with SMTP id j144mr15099926ybg.337.1626465704938; Fri, 16 Jul 2021 13:01:44 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::b34; envelope-from=thibaut.verron@gmail.com; helo=mail-yb1-xb34.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:131770 Archived-At: Le ven. 16 juil. 2021 =C3=A0 17:01, Stefan Monnier via Users list for the GNU Emacs text editor a =C3=A9crit : > > > Now I'm curious too... Would something like this work? > > > > (let ((inhibit-quit t)) > > (setq process > > (let ((inhibit-quit nil)) > > (ftp-setup-buffer host file)))) > > No. The problem is not in the `setq` itself but in the fact that > a non-local exit from `ftp-setup-buffer` (e.g. because of `C-g`) will > cause `ftp-setup-buffer` not to return the process. Ah, thanks for the clarification. > > We should devise a more reliable API, tho I'm not completely sure what > it should look like. Maybe > > (let ((list-of-created-processes nil)) > (unwind-protect ... > (mapc #'delete-process list-of-created-processes))) > > Where the low-level primitives which create processes add them to > `list-of-created-processes`. But wouldn't that run into the same sort of race conditions as the other case? Where a process would be created, but the parent function would be killed before the process is added to the list? If not, why not simply add an unwind-protect as tight as possible around the form actually creating the process?