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

岳帅杰 ysj.ray at gmail.com
Wed Nov 11 12:13:59 GMT 2009


Hi, Tom:

	I got it.
	There is no particular reason I need to have multiple writer threads. 
	Thanks for your help! 



2009-11-11 
-----------------
Best wishes from Ray. 



发件人: Tom 
发送时间: 2009-11-11  19:30:35 
收件人: 岳帅杰 
抄送: xapian-discuss 
主题: Re: [Xapian-discuss] 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


More information about the Xapian-discuss mailing list