emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Experiment with threads - no concurrency?


From: Arthur Miller
Subject: Re: Experiment with threads - no concurrency?
Date: Mon, 06 Sep 2021 18:35:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]