unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Elias Mårtenson" <lokedhs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Threading IO-bound functions
Date: Mon, 19 Dec 2016 11:03:32 +0800	[thread overview]
Message-ID: <CADtN0WJQbtEkFaXEmnNmLp8uKFSa5A=WQrk4b0Px3Dh4je_qrg@mail.gmail.com> (raw)
In-Reply-To: <8360mj99oe.fsf@gnu.org>

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

On 16 December 2016 at 23:26, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Elias Mårtenson <lokedhs@gmail.com>
> > Date: Thu, 15 Dec 2016 12:01:51 +0800
> >
> > The number one function that I call that sometimes hang for a
> significant amount of time is ‘gnus’. I decided to
> > try running it in a thread, and it worked surprisingly well. Initial
> loading of the messages can now be done in the
> > background.
>
> Beginner's luck ;-)
>

Oh for sure. I was also careful not to do anything that may upset it (like
running other gnus-functions at the same time).

The fact that my macro implements one lock per function only makes it
usable for single-operation functions. Gnus should probably a global lock
that ensures that only one Gnus function at a time is called. This issue
can't be limited to just Gnus, so perhaps Emacs should provide some
higher-level facility to implement this stuff.


> Did you try this in "emacs -nw"?  And without your Gnus
> customizations, which allow some shortcuts?  Half way through its
> initialization, Gnus asks a question, and then you get bug#25214.
>

I was using the GTK Emacs, and yes, if it asks a question, the entire Emacs
crashes is the most bizarre way.

My workaround is simply making sure that it doesn't interact with the user.


> > I'd like to have people's opinions on this strategy, and if it might be
> reasonable to default ‘gnus’ to do this when
> > run on Emacs versions with concurrency support.
>
> I think we need first to solve the above problem in some way.  Or
> change Gnus to not ask any questions from a background thread.
>

I think most questions are asked using ‘read-string’ or some variant like
‘completing-read’, right? At the very least, I think that concurrent Emacs
needs to make sure that the behaviour of these functions are well-defined
in the context of threading.

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

  reply	other threads:[~2016-12-19  3:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-15  4:01 Threading IO-bound functions Elias Mårtenson
2016-12-16 15:26 ` Eli Zaretskii
2016-12-19  3:03   ` Elias Mårtenson [this message]
2016-12-19  3:39     ` Eli Zaretskii
2016-12-19  7:06       ` Elias Mårtenson
2016-12-19 17:32         ` Eli Zaretskii
2016-12-19 17:43         ` The event handling thread (was: Threading IO-bound functions) John Wiegley
2016-12-20 16:08           ` Eli Zaretskii
2016-12-21  1:04             ` The event handling thread John Wiegley
2016-12-21 11:05               ` Elias Mårtenson
2016-12-21 17:42                 ` Eli Zaretskii
2016-12-22  3:12                   ` Elias Mårtenson
2016-12-22 17:37                     ` Eli Zaretskii
2016-12-16 22:05 ` Threading IO-bound functions Ken Raeburn

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='CADtN0WJQbtEkFaXEmnNmLp8uKFSa5A=WQrk4b0Px3Dh4je_qrg@mail.gmail.com' \
    --to=lokedhs@gmail.com \
    --cc=eliz@gnu.org \
    --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).