From: Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: unwind-protect and inhibit-quit
Date: Fri, 16 Jul 2021 16:06:33 -0400 [thread overview]
Message-ID: <jwvh7guf2lg.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: CAFsi02Q-nF4huiXRh-j3u=W+sBSv=LzVhRg8SpNqJNH+d40UAw@mail.gmail.com
>> 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?
No, because the process would (presumably) get added "atomically" to
`list-of-created-processes` as it is created (i.e. either it gets
created and gets added to the list, or it's not created), and so it doesn't
matter what the intermediate code does and returns.
> If not, why not simply add an unwind-protect as tight as possible
> around the form actually creating the process?
Because the above `unwind-protect` needs to be placed at the spot where
one does not need the process any more.
Stefan
next prev parent reply other threads:[~2021-07-16 20:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-15 15:14 unwind-protect and inhibit-quit Felix Dietrich
2021-07-16 7:18 ` Eli Zaretskii
2021-07-16 8:10 ` Thibaut Verron
2021-07-16 11:19 ` Eli Zaretskii
2021-07-16 14:46 ` Felix Dietrich
2021-07-16 14:56 ` Felix Dietrich
2021-07-16 15:00 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-07-16 20:01 ` Thibaut Verron
2021-07-16 20:06 ` Stefan Monnier via Users list for the GNU Emacs text editor [this message]
2021-07-16 21:30 ` Felix Dietrich
2021-07-16 21:37 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-07-17 11:52 ` Felix Dietrich
2021-07-17 6:20 ` Eli Zaretskii
2021-07-17 15:46 ` Felix Dietrich
2021-07-17 16:34 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvh7guf2lg.fsf-monnier+emacs@gnu.org \
--to=help-gnu-emacs@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.