[Xapian-discuss] Terminating a Xapian query

Jean-Francois Dockes jf at dockes.org
Fri Sep 25 12:40:07 BST 2009


James Aylett writes:
 > 
 > On Fri, Sep 25, 2009 at 11:32:14AM +0200, Jean-Francois Dockes wrote:
 > 
 > > I think that there will always be worst case scenarios where the user will
 > > wish he had a Cancel button, and I have little idea how to offer one right
 > > now...
 > 
 > Generally speaking, your user interface should not be managed by the
 > same thread that any long-running process acts in. Without knowing
 > more about your application and platform I can't really say anything
 > further that's of help, but separating them out might allow you to
 > ignore this completely (having running searches the user can come back
 > to later), or manage things a little differently (if you don't use
 > remote backends, having a dedicated thread that runs searches, which
 > you can kill; but create the Database object in a separate thread).

Recoll is a QT app running under Unix/Linux, and it can use Posix threads.

I am not sure that I understand your last sentence.

Does it mean that all resources allocated by a thread executing get_mset()
(for example) are referenced by the Database object at all (cancellable)
times ? Is this something that is guaranteed by the Xapian API "contract" ?

As far as I understand, thread cancellation safety is a very strong
constraint, it can preclude things as simple as allocating a local c++
string inside a function (under conditions).  Was the Xapian search code
specifically designed with this in mind ?

jf



More information about the Xapian-discuss mailing list