[Xapian-discuss] Xapian::Document and threads
Olly Betts
olly at survex.com
Sun May 4 23:31:30 BST 2014
On Sun, May 04, 2014 at 08:16:50PM +0200, Jean-Francois Dockes wrote:
> While investigating very infrequent crashes in the Recoll indexer, I have
> come to a very basic question: is it safe to pass a copy of a
> Xapian::Document from thread to thread (multiple threads queue documents,
> other thread updates the index) ?
>
> I don't seem to get directly into trouble while doing this, but I don't see
> anything either in the RefCntr implementation which would explicitely make
> it thread-safe, so I am wondering. Maybe I'm just missing the obvious.
http://getting-started-with-xapian.readthedocs.org/en/latest/concepts/concurrency.html
> Of course, I could create the docs on the heap instead, and pass pointers,
> but is this needed ?
That might help if it's just the reference counting that's the issue,
but bear in mind that the underlying object gives you no thread-safety
guarantees either.
Cheers,
Olly
More information about the Xapian-discuss
mailing list