From: ndame <laszlomail@protonmail.com>
To: Philipp <p.stephani2@gmail.com>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: Is automatic yield support feasible for threads?
Date: Wed, 10 Nov 2021 07:46:48 +0000 [thread overview]
Message-ID: <WrnCK-thR61PqmwodwrIjmAUnia9XIncEzC5DLlwlcDmu90mAyIfes9wdIyLSrWCc38fPghlYfgvAKV7vBzwqrcSfkiNDyB8KxgIl35n1dw=@protonmail.com> (raw)
In-Reply-To: <46501A5F-9C72-4048-8EEA-CE219D54CEC2@gmail.com>
On Tuesday, November 9th, 2021 at 3:53 PM, Philipp <p.stephani2@gmail.com> wrote:
>
> I don't think it's feasible. Emacs Lisp code typically relies heavily on mutating global state (think buffer contents, the buffer list, `point', dynamic variables, ...), and normally doesn't put such state mutations into properly synchronized critical sections. Yielding from such unprotected critical sections would result in very subtle bugs (`point' randomly moving around, corruption of internal data structures, buffers vanishing surprisingly, ...).
I don't think threads should be used for UI manipulation, that should be left for the main thread. Threads are more useful for longer running calculations, computations and those should have no problem if they work on local data.
But you are right if someone uses a thread for UI changes then there can be problems. My idea is about an _optional_ automatic yielding for threads, so it still could be useful for those threads which are self contained. Those could choose to start with periodic automatic yielding, so their code do not have to be sprinkled with manual yield calls, impacting code readability.
next prev parent reply other threads:[~2021-11-10 7:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-04 17:10 Is automatic yield support feasible for threads? ndame via Users list for the GNU Emacs text editor
2021-11-09 14:53 ` Philipp
2021-11-10 7:46 ` ndame [this message]
2021-11-10 13:46 ` Eli Zaretskii
2021-11-11 18:11 ` Philipp
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='WrnCK-thR61PqmwodwrIjmAUnia9XIncEzC5DLlwlcDmu90mAyIfes9wdIyLSrWCc38fPghlYfgvAKV7vBzwqrcSfkiNDyB8KxgIl35n1dw=@protonmail.com' \
--to=laszlomail@protonmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=p.stephani2@gmail.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).