help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unwind-protect and inhibit-quit


From: Thibaut Verron
Subject: Re: unwind-protect and inhibit-quit
Date: Fri, 16 Jul 2021 22:01:33 +0200

Le ven. 16 juil. 2021 à 17:01, Stefan Monnier via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> a écrit :
>
> > 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?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]