emacs-devel
[Top][All Lists]
Advanced

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

Re: Threading IO-bound functions


From: Ken Raeburn
Subject: Re: Threading IO-bound functions
Date: Fri, 16 Dec 2016 17:05:36 -0500

On Dec 14, 2016, at 23:01, Elias Mårtenson <address@hidden> wrote:

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

I’m a bit surprised… pleased, but surprised… :-)

> 
> To prevent myself from running this function more than once at the same time, 
> I created a wrapper function for this, and I have extracted it into a macro.
> 
> 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.

For a few things I think it might be reasonable.  But with something like Gnus, 
there are many things one might want to do in background (fetch the initial 
list of newsgroups and article counts, update that list, fetch article lists 
when entering a newsgroup), and — just generally speaking — each of them has to 
lock out all the others, lest they stomp on each others’ data structures.

The one advantage the “gnus” command has, specifically, compared to the whole 
rest of Gnus, is that it can do the initial setting up of those data 
structures.  If the group buffer isn’t ready for command input (what key 
bindings are applicable at that point?), it’s harder to trigger other Gnus 
commands to run.

Though, what about sending email with message mode?  If I use a “Gcc:” header 
to save sent emails in an IMAP folder, what happens if Gnus is only part-way 
set up?

When do gnus-demon timers get set up?  Can they fire before gnus is ready?

Etc….

Ken


reply via email to

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