all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: Lynn Winebarger <owinebar@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,  emacs-devel@gnu.org
Subject: Re: Blocking calls and threads
Date: Thu, 20 Apr 2023 21:28:01 +0800	[thread overview]
Message-ID: <875y9qfztq.fsf@yahoo.com> (raw)
In-Reply-To: <CAM=F=bCxzudqM3m=aN=AndOWAt0Y14Y6WDrrTbyjfRaD-vVUsw@mail.gmail.com> (Lynn Winebarger's message of "Thu, 20 Apr 2023 09:06:16 -0400")

Lynn Winebarger <owinebar@gmail.com> writes:

> Presumably whatever mechanism is used for the calls you identified
> below could be generalized.  In practical terms, it would mean
> assigning locks to every system resource that isn't inherently part of
> the lisp machine, in this case at least file descriptors.  Then, for
> example, the read call in emacs_intr_read (in sysdep.c) could be
> surrounded by a release of the global lock (which yields the thread of
> the lisp machine) and the re-acquisition of the global lock.  The file
> descriptor lock might be acquired after yielding the lisp thread, or
> it might be owned exclusively by the thread that opened it.

I'm afraid that's not so easy.  Parts of Emacs have certainly been
designed with the assumption that context switching cannot happen inside
read and friends; at least the Android and NS ports have this problem.

> Are these identified as a group anywhere for reference?  Otherwise, I
> don't know what is included in the "etc".

Basically anything that calls `thread_select'.  This includes almost
everything that waits for input.  Please grep around in the C sources.



  reply	other threads:[~2023-04-20 13:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20  5:31 Blocking calls and threads Lynn Winebarger
2023-04-20  7:00 ` Po Lu
2023-04-20  7:23 ` Eli Zaretskii
2023-04-20 13:06   ` Lynn Winebarger
2023-04-20 13:28     ` Po Lu [this message]
2023-04-20 14:26       ` Lynn Winebarger
2023-04-20 13:37     ` Eli Zaretskii
2023-04-20 14:19       ` Lynn Winebarger
2023-04-20 14:36         ` Eli Zaretskii
2023-04-21  4:39           ` Lynn Winebarger
2023-04-21 13:43             ` Lynn Winebarger

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=875y9qfztq.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=owinebar@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.
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.