unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Is automatic yield support feasible for threads?
@ 2021-11-04 17:10 ndame via Users list for the GNU Emacs text editor
  2021-11-09 14:53 ` Philipp
  0 siblings, 1 reply; 5+ messages in thread
From: ndame via Users list for the GNU Emacs text editor @ 2021-11-04 17:10 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-11 18:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2021-11-10 13:46     ` Eli Zaretskii
2021-11-11 18:11     ` Philipp

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).