[pylucene-dev] gcj garbage collector initialisation and threads
Andi Vajda
vajda at osafoundation.org
Fri Jul 14 11:32:08 PDT 2006
On Fri, 14 Jul 2006, David Fraser wrote:
> Have been trying to research PyLucene under mod_python and the current
> threading problem. Found the following bug report:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13212 - JNI/CNI
> AttachCurrentThread does not register thread with garbage collector
> which I presume is the underlying issue.
> There's a patch in that issue which apparently adds the necessary
> changes to be able to attach the GC to a native thread after creation.
> Would this be the right approach to enabling PyLucene to be able to work
> in standard Python threads?
> I presume we'd have to remember whether the current thread has been
> attached or not, and attach it if neccessary
Until this is supported by the GC module in libgcj (an old bug, but with a
intent of making it work in the future, quoting Hans Boehm, its author), the
usual trick is to use PyLucene.PythonThread which is a subclass of python's
thread class which delegates the starting of the underlying OS thread to
libgcj.
There are usually ways to customize the web service setup so that it runs in
instances of PyLucene.PythonThread. What they are for mod_python, I don't
know, but this is definitely the number one FAQ on this list :)
Andi..
More information about the pylucene-dev
mailing list