unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: zhanghj <ccsmile2008@outlook.com>
To: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: Emacs design and architecture. How about copy-on-write?
Date: Thu, 21 Sep 2023 04:51:13 +0800	[thread overview]
Message-ID: <TYCP286MB221075101A279B3ACC2AFDF3A8F9A@TYCP286MB2210.JPNP286.PROD.OUTLOOK.COM> (raw)

[-- Attachment #1: Type: text/plain, Size: 1514 bytes --]

    The same will happen if only the main thread can display.  If a
    non-main thread wants to prompt the user, it will have to wait until
    the main thread becomes available, prompts the user, and returns the
    response.

    Someone always has to wait when threads need to synchronize.  There's
    no way around that.  Doing this in the thread that needs to
    display/prompt is easier because the context and relevant variables
    don't need to be communicated to another thread.

Sorry for my poor English.

Message queue is a good solution for parallel and concurrence.

I think it is not a good idea to let all threads to do display things directly.
It will be better to let non-main threads to do display things via message queue,
like many GUI toolkit does. It is also like the message loop in Emacs.
This will make many things easier.

For GUI toolkit on windows, there are two basic API: Sendmessage and PostMessage.
Non-gui thread can use theme to do display and UI related things.

For example in Emacs, when a non-main thread calls `message', a small display task is built
and put into the message queue of the main thread, like `PostMessage` does.
If it calls `read-file-name`, an UI task is built and put into the message queue of
the main thread like `SendMessage` does, while the caller thread will be blocked until result comes.

When all display jobs are all in one thread (decoupled with other threads), display jobs may be scheduled
more efficiently and may be concurrent internally.

[-- Attachment #2: Type: text/html, Size: 1685 bytes --]

             reply	other threads:[~2023-09-20 20:51 UTC|newest]

Thread overview: 154+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20 20:51 zhanghj [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-09-21  9:43 Emacs design and architecture. How about copy-on-write? Payas Relekar
2023-09-15  9:32 Emacs design and architecture Gerd Möllmann
2023-09-15 15:52 ` Dmitry Gutov
2023-09-15 18:36   ` Gerd Möllmann
2023-09-15 18:42     ` Eli Zaretskii
2023-09-15 19:19       ` Gerd Möllmann
2023-09-15 22:20         ` Dmitry Gutov
2023-09-15 23:58           ` Emanuel Berg
2023-09-16  6:00             ` Eli Zaretskii
2023-09-17 12:16               ` Emanuel Berg
2023-09-17 14:24                 ` Eli Zaretskii
2023-09-17 15:36                   ` Emacs design and architecture. How about copy-on-write? Alan Mackenzie
2023-09-18 10:30                     ` Eli Zaretskii
2023-09-18 11:38                       ` Alan Mackenzie
2023-09-18 12:08                         ` Eli Zaretskii
2023-09-18 12:49                           ` Ihor Radchenko
2023-09-18 14:27                             ` Eli Zaretskii
2023-09-18 15:55                               ` Ihor Radchenko
2023-09-18 17:47                                 ` Eli Zaretskii
2023-09-18 22:48                                   ` Emanuel Berg
2023-09-19 10:53                                     ` Eli Zaretskii
2023-09-19 11:14                                       ` Emanuel Berg
2023-09-19 12:37                                         ` Ihor Radchenko
2023-09-19 19:21                                           ` Emanuel Berg
2023-09-20  9:56                                             ` Ihor Radchenko
2023-09-22 15:50                                               ` Emanuel Berg
2023-09-22 16:15                                                 ` Ihor Radchenko
2023-09-22 16:22                                                   ` Emanuel Berg
2023-09-22 18:08                                                   ` Eli Zaretskii
2023-09-19 19:34                                           ` Emanuel Berg
2023-09-20  9:59                                             ` Ihor Radchenko
2023-09-20 10:22                                               ` Po Lu
2023-09-20 10:56                                                 ` Ihor Radchenko
2023-09-20 11:11                                                   ` Po Lu
2023-09-20 11:53                                                     ` Ihor Radchenko
2023-09-20 11:58                                                       ` Po Lu
2023-09-20 12:05                                                         ` Ihor Radchenko
2023-09-20 13:35                                                     ` Po Lu
2023-09-20 15:53                                                       ` Eli Zaretskii
2023-09-21  0:55                                                         ` Po Lu
2023-09-21  3:35                                                           ` Po Lu
2023-09-21  7:27                                                           ` Eli Zaretskii
2023-09-21  7:34                                                             ` Po Lu
2023-09-21  8:13                                                               ` Eli Zaretskii
2023-09-21  8:35                                                                 ` Ihor Radchenko
2023-09-21  9:59                                                                   ` Eli Zaretskii
2023-09-21 10:13                                                                     ` Ihor Radchenko
2023-09-21 11:49                                                                       ` Po Lu
2023-09-21 23:43                                                                         ` Dmitry Gutov
2023-09-21 12:57                                                                       ` Eli Zaretskii
2023-09-21 13:12                                                                         ` Po Lu
2023-09-21 13:29                                                                           ` Eli Zaretskii
2023-09-21 13:35                                                                             ` Po Lu
2023-09-21 13:49                                                                               ` Eli Zaretskii
2023-09-21 13:57                                                                                 ` Po Lu
2023-09-21 14:10                                                                                   ` Eli Zaretskii
2023-09-21  9:14                                                                 ` Po Lu
2023-09-22 15:59                                               ` Emanuel Berg
2023-09-19 12:38                                         ` Eli Zaretskii
2023-09-19 12:57                                           ` Po Lu
2023-09-19 14:36                                             ` Eli Zaretskii
2023-09-20  1:05                                               ` Po Lu
2023-09-20 12:02                                                 ` Eli Zaretskii
2023-09-20 12:09                                                   ` Ihor Radchenko
2023-09-20 12:27                                                   ` Po Lu
2023-09-19 19:38                                           ` Emanuel Berg
2023-09-20 12:35                                             ` Eli Zaretskii
2023-09-22 14:22                                               ` Emanuel Berg
2023-09-22 15:51                                                 ` Eli Zaretskii
2023-09-22 16:00                                                   ` Emanuel Berg
2023-09-22 19:00                                                     ` Eli Zaretskii
2023-09-22 21:14                                                       ` Emanuel Berg
2023-09-22 16:11                                                   ` Ihor Radchenko
2023-09-22 16:14                                                     ` Eli Zaretskii
2023-09-22 16:27                                                       ` Ihor Radchenko
2023-09-22 17:19                                                         ` Emanuel Berg
2023-09-22 16:13                                                   ` tomas
2023-09-19 11:36                                   ` Ihor Radchenko
2023-09-19 12:34                                     ` Eli Zaretskii
2023-09-19 13:35                                       ` Ihor Radchenko
2023-09-19 14:14                                         ` Eli Zaretskii
2023-09-19 15:15                                           ` Dmitry Gutov
2023-09-19 15:37                                             ` Eli Zaretskii
2023-09-19 16:01                                               ` Dmitry Gutov
2023-09-19 17:54                                                 ` Eli Zaretskii
2023-09-19 20:21                                                   ` Dmitry Gutov
2023-09-20 11:28                                                     ` Eli Zaretskii
2023-09-20 11:38                                                       ` Ihor Radchenko
2023-09-20 14:35                                                         ` Eli Zaretskii
2023-09-21 10:41                                                           ` Ihor Radchenko
2023-09-21 13:26                                                             ` Eli Zaretskii
2023-09-22 10:05                                                               ` Ihor Radchenko
2023-09-22 11:53                                                                 ` Eli Zaretskii
2023-09-22 12:49                                                                   ` Ihor Radchenko
2023-09-22 13:01                                                                     ` Eli Zaretskii
2023-09-22 13:08                                                                       ` Ihor Radchenko
2023-09-20 12:21                                                       ` Po Lu
2023-09-20 14:51                                                         ` Eli Zaretskii
2023-09-20 19:39                                                           ` Dmitry Gutov
2023-09-21  4:31                                                             ` Eli Zaretskii
2023-09-21 10:41                                                               ` Dmitry Gutov
2023-09-21 22:21                                                             ` Stefan Kangas
2023-09-21 23:01                                                               ` Dmitry Gutov
2023-09-21  0:41                                                           ` Po Lu
2023-09-21  2:23                                                             ` Adam Porter
2023-09-21  2:53                                                               ` Po Lu
2023-09-21  7:25                                                             ` Eli Zaretskii
2023-09-21  7:48                                                               ` Po Lu
2023-09-21  8:18                                                                 ` Eli Zaretskii
2023-09-21  9:25                                                                   ` Po Lu
2023-09-21  9:39                                                                     ` Ihor Radchenko
2023-09-21 10:36                                                                       ` Dmitry Gutov
2023-09-21 10:48                                                                         ` Ihor Radchenko
2023-09-21 11:10                                                                           ` Dmitry Gutov
2023-09-21 11:17                                                                             ` Ihor Radchenko
2023-09-21 11:27                                                                               ` Dmitry Gutov
2023-09-21 13:00                                                                           ` Eli Zaretskii
2023-09-21 13:30                                                                             ` Dmitry Gutov
2023-09-21 13:44                                                                               ` Eli Zaretskii
2023-09-22  1:29                                                                                 ` Dmitry Gutov
2023-09-22 10:51                                                                                   ` Ihor Radchenko
2023-09-22 10:28                                                                                 ` Ihor Radchenko
2023-09-22 12:26                                                                                   ` Eli Zaretskii
2023-09-22 13:06                                                                                     ` Ihor Radchenko
2023-09-22 13:12                                                                                       ` Eli Zaretskii
2023-09-21 10:03                                                                     ` Eli Zaretskii
2023-09-20 19:22                                                       ` Dmitry Gutov
2023-09-21  4:29                                                         ` Eli Zaretskii
2023-09-21 20:24                                                     ` Richard Stallman
2023-09-20  9:47                                           ` Ihor Radchenko
2023-09-20 14:02                                             ` Eli Zaretskii
2023-09-21 10:29                                               ` Ihor Radchenko
2023-09-21 14:02                                                 ` Eli Zaretskii
2023-09-22 10:48                                                   ` Ihor Radchenko
2023-09-22 12:34                                                     ` Eli Zaretskii
2023-09-23 11:07                                                       ` Ihor Radchenko
2023-09-23 11:23                                                         ` Eli Zaretskii
2023-09-23 12:53                                                           ` Dmitry Gutov
2023-09-23 13:01                                                             ` Eli Zaretskii
2023-09-23 13:08                                                               ` Dmitry Gutov
2023-09-23 13:15                                                                 ` Eli Zaretskii
2023-09-23 14:09                                                                   ` Ihor Radchenko
2023-09-24  0:29                                                                   ` Dmitry Gutov
2023-09-23 14:23                                                                 ` Yuri Khan
2023-09-23 14:25                                                                   ` Dmitry Gutov
2023-09-18 13:30                           ` Po Lu
2023-09-18 13:34                             ` Po Lu
2023-09-18 13:55                             ` Ihor Radchenko
2023-09-18 15:04                             ` Eli Zaretskii
2023-09-18 23:41                               ` Po Lu
2023-09-19 14:25                                 ` Eli Zaretskii
2023-09-20  1:01                                   ` Po Lu
2023-09-20 11:56                                     ` Eli Zaretskii
2023-09-20 12:13                                       ` Po Lu
2023-09-20 14:46                                         ` Eli Zaretskii
2023-09-20 18:50                                         ` Dmitry Gutov
2023-09-21  4:23                                           ` Eli Zaretskii
2023-09-21 10:08                                       ` Ihor Radchenko
2023-09-21 10:12                                         ` Eli Zaretskii
2023-09-21 10:35                                           ` Ihor Radchenko
2023-09-21 13:13                                             ` Eli Zaretskii
2023-09-19 21:37                                 ` Björn Bidar
2023-09-19 10:20                     ` Richard Stallman

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=TYCP286MB221075101A279B3ACC2AFDF3A8F9A@TYCP286MB2210.JPNP286.PROD.OUTLOOK.COM \
    --to=ccsmile2008@outlook.com \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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