Re: Thread safety?

Subject: Re: Thread safety?

Date: Wed, 22 Feb 2023 00:00:04 +0100

To: David Bremner

Cc: notmuch@notmuchmail.org

From: Kevin Boulain


On 2023-02-21 at 07:59 -04, David Bremner <david@tethera.net> wrote:
> Thanks for tracking this down. I did try some experiments a while ago
> with multi-threaded indexing (which is where the locking you mentioned
> arose), but overall it isn't well tested (by me).

To be honest I struggled a bit, notably on GLib which emitted false
positives under -fsanitize so I resorted to debugging that one manually
(but maybe I missed something obvious).
I only discovered the issue because the test framework I'm using runs
the tests in different threads.

> It seems reasonable to try to provide the same level of thread safety
> as Xapian does.

That's good to hear.

> So I guess we should go ahead and replace all of the MatchAll objects.
> I'm guessing this might apply to Xapian::Query::MatchNothing as well.
> Probably preprocessor macros wrapping Xapian::Query(std::string()) and
> whatever the equivalent for MatchNothing is would make this easier to
> read.

The documentation of MatchNothing says it's thread-safe.

If you'd like, I'm happy to submit a patch (likely very small, given the
limited number of occurrences) after I review a bit more the
documentation and the code (I'm just starting with Notmuch and Xapian so
that's probably the extent of what I can do).
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: