[Xapian-discuss] Is there any problem with multithread?

Tom tom at lemurconsulting.com
Wed Nov 11 11:30:34 GMT 2009


2009/11/11 岳帅杰 <ysj.ray at gmail.com>:
> Hi, all:
>
>        I am now using xapian in a web environment, I need multithread for writing the database.
>        So I wonder if there is any problem with multithread for writing?(all the threads share a single WritableDatabase object)

Hi Ray,

WritableDatabase objects can only be used by a single thread.
Generally the best approach is to marshal all your writes into a
single structure (e.g. a queue or spool directory) and have a thread
or process to pick off items and write them to the database.

Is there any particular reason you want to have multiple writer threads?

cheers,
Tom



More information about the Xapian-discuss mailing list