Attached is a simple patch to enable monkeypatching the standard library's 
threading module.  One would use it like:

import PyLucene
PyLucene.monkeypatch()

*before* importing any other modules that used `threading` (in other words, at 
the start of your program). This seems like the easiest way to solve the 
all-threads-must-be-PyLucene.PythonThread problem and should work with both 
2.4 and 2.5.

Andi, any objection to including it in future releases?

--Pete

PS - No, this will not allow PyLucene to be used under mod_python.

-- 
Peter Fein   ||   773-575-0694   ||   [EMAIL PROTECTED]
http://www.pobox.com/~pfein/   ||   PGP: 0xCCF6AE6B
irc: [EMAIL PROTECTED]   ||   jabber: [EMAIL PROTECTED]
--- PyLucene.py.orig	2007-05-09 13:55:48.717128000 -0500
+++ PyLucene.py	2007-05-09 14:15:06.073458250 -0500
@@ -83,3 +83,8 @@
                 thread.join(long(timeout * 1000))
             else:
                 thread.join()
+
+def monkeypatch():
+    """monkey patch standard library threading module to use PythonThread"""
+    threading.Thread=PythonThread
+    threading._Timer.__bases__=(PythonThread,)
\ No newline at end of file
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to