Xapian (and therefore Notmuch? I would not mind a confirmation here) is thread safe as long as you don't share DB instances across threads. The database backend supports one writer and several concurrent readers. One possible model for multi threaded apps using Notmuch is to have one thread with a writable notmuch_database_t, and various with read-only notmuch_database_t instances. However, for the readers to see the changes done by the writer, the writer needs to flush the changes to disk, and the readers need to reopen the database. Those two patches add two methods to notmuch_database_t for this purpose (the signaling of the writer to the readers that they need to reopen is left to the application).
Adrien Bustany (2): Add notmuch_database_flush method Add notmuch_database_reopen method lib/database.cc | 35 +++++++++++++++++++++++++++++++++++ lib/notmuch.h | 12 ++++++++++++ 2 files changed, 47 insertions(+), 0 deletions(-) -- 188.8.131.52