[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unwind-protect and inhibit-quit
From: |
Stefan Monnier |
Subject: |
Re: unwind-protect and inhibit-quit |
Date: |
Fri, 16 Jul 2021 16:06:33 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
>> 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
- unwind-protect and inhibit-quit, Felix Dietrich, 2021/07/15
- Re: unwind-protect and inhibit-quit, Felix Dietrich, 2021/07/16
- Re: unwind-protect and inhibit-quit, Stefan Monnier, 2021/07/16
- Re: unwind-protect and inhibit-quit, Felix Dietrich, 2021/07/17
- Re: unwind-protect and inhibit-quit, Eli Zaretskii, 2021/07/17
- Re: unwind-protect and inhibit-quit, Felix Dietrich, 2021/07/17
- Re: unwind-protect and inhibit-quit, Eli Zaretskii, 2021/07/17