[notmuch] Multithreaded access

Peter Wang novalazy at gmail.com
Mon Nov 23 03:07:42 PST 2009


Hi,

I am also toying around with a curses frontend for notmuch :-)
One thing that I would really like to have is asynchronous search:
I should be able to begin reading mail even while search results
are rolling in.

At the moment I'm using one read-only database_t* and creating multiple
queries off it.  There's a background thread[1] slurping up <n> search
results at a time, then passes them to the main thread.  The main thread
also handles the pager.  When the user goes to open a thread, it creates
a separate query_t so that it can look up the messages and their headers
and filenames.

It seems to work, but sometimes crashes.  I'm wondering if there is
something inherently wrong with this design, so that I should try a
different approach.

A future concern is how to handle tag updates.  Could I open the database
for writing in one thread, and read-only in another?

Peter

[1] Actually, I am playing around with Go at the same time so they are
really goroutines.  Any problems could very well be related to this.


More information about the notmuch mailing list