all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Arthur Miller <arthur.miller@live.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Experiment with threads - no concurrency?
Date: Mon, 06 Sep 2021 18:35:16 +0200	[thread overview]
Message-ID: <AM9PR09MB4977BA0A1925A1B6D58D34D396D29@AM9PR09MB4977.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <jwvbl557n47.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 06 Sep 2021 11:17:00 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Since it is kind of lot's of I/O and independent tasks to do, I thought threads
>> could come handy. However I see no difference from sequential code.
>
> This is a common misunderstanding, it seems. 
Well it woudl be probably misunderstanding on my part, since I thought that
threads are just a wrapper on pthreads and tried to translate my thread
understanding from other languages. As I am used to, I/O would normally block
and threads would be swtiched (in Java).

> you tell us what parts of our docs (docstrings or Texinfo manual) you
> consulted before coming here?
>

"Currently, thread switching will occur upon explicit request via thread-yield,
when waiting for keyboard input or for process output from asynchronous
processes (e.g., during accept-process-output), or during blocking operations
relating to threads, such as mutex locking or thread-join."

That is the only part that mentions where threads will switch, and it does not
mention blocking on I/O so I guess it was misunderstanding on my parts. Maybe it
can help guys like me, who assume things based on some previous usage from other
places and languages, if you mention this common misunderstanding somewhere, and
how Emacs threads compare to some other thread implementations like Java threads
or pthreads?

This also leaves me with a question: what is practical use for Emacs threads? Is
there any internal code that uses threads so I can look at a practical example?



  reply	other threads:[~2021-09-06 16:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-06 14:35 Experiment with threads - no concurrency? Arthur Miller
2021-09-06 15:17 ` Stefan Monnier
2021-09-06 16:35   ` Arthur Miller [this message]
2021-09-06 17:31     ` Eli Zaretskii
2021-09-06 17:38   ` T.V Raman
2021-09-06 18:11     ` Arthur Miller
2021-09-06 15:47 ` Eli Zaretskii
2021-09-06 16:40   ` Arthur Miller
2021-09-06 17:33     ` Eli Zaretskii
2021-09-06 18:10       ` Arthur Miller

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=AM9PR09MB4977BA0A1925A1B6D58D34D396D29@AM9PR09MB4977.eurprd09.prod.outlook.com \
    --to=arthur.miller@live.com \
    --cc=emacs-devel@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.