Tom | 11 Nov 12:30
Gravatar

Re: Is there any problem with multithread?

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

_______________________________________________
Xapian-discuss mailing list
Xapian-discuss <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-discuss

Gmane