all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ndame via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Is automatic yield support feasible for threads?
Date: Thu, 04 Nov 2021 17:10:05 +0000	[thread overview]
Message-ID: <AVNN0Fy5Nl_7QuayhKKu5ANdTl0LfeVRUrI2mbxCRQFy4uMYogo0xEGiVK0-33H-jFh8HnyWCFbygrbUPS0PU7dCxh4tAstItkTfs871Zyg=@protonmail.com> (raw)

AFAIK Emacs has cooperative threading, so a badly behaving thread can prevent UI updates, therefore if some costly operation is moved into a separate thread then the code has to be modified in order to yield periodically if the code doesn't do I/O.

If that's the case then what if the interpreter itself could support automatic yielding when some flag is set, so it could yield automatically after every several instructions?

For example, make-thread could have an optional argument specifying after how many instructions a thread-yield should be called automatically and if this argument is set then a global flag is set, so the interpreter knowns it should call yield regularly.

This automatic yielding would have some cost, but in return any code could safely be moved into a separate thread without the danger of locking up the UI if this optional argument is given to make-thread. So it could makes using cooperative threads easier.

Could such an automatic yield support be feasible for threads?

             reply	other threads:[~2021-11-04 17:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04 17:10 ndame via Users list for the GNU Emacs text editor [this message]
2021-11-09 14:53 ` Is automatic yield support feasible for threads? Philipp
2021-11-10  7:46   ` ndame
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AVNN0Fy5Nl_7QuayhKKu5ANdTl0LfeVRUrI2mbxCRQFy4uMYogo0xEGiVK0-33H-jFh8HnyWCFbygrbUPS0PU7dCxh4tAstItkTfs871Zyg=@protonmail.com' \
    --to=help-gnu-emacs@gnu.org \
    --cc=laszlomail@protonmail.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.
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.