[omniORB] Threads management for omniORBpy

Yura Smolsky info at altervision.biz
Fri Feb 11 16:56:14 GMT 2005


Hello, Duncan.
>> What is the purpose of class WorkerThread(threading.Thread) defined
>> in the omniORB/__init__.py? What does create instances of this class?
DG> It provides an object to be returned from threading.currentThread(). It
DG> is created the first time an omniORB thread is used to call into Python,
DG> and removed when the thread is about to exit, or hasn't been used for
DG> Python calls for a while. It's called from code in pyThreadCache.cc. You
DG> can add a hook to it with omniORB.addWThreadHook, documented in
DG> omniORB/__init__.py.

DG> Are you just asking out of interest, or do you have a specific problem?

Actually, I have very spicific problem. I am trying to use PyLucene
lib ported from Java to Python through simple omniORBpy Servant.

Problem: PyLucene lib require all threads which operate to PyLucene
object to be inherited from
PyLucene.PythonThread. PythonThread is initializated from Java. So, I
need somehow inherit all "worker" omniORB threads from PyLucene.PythonThread.

I have done dirty hack in the omniORB/__init__.py this way:

from PyLucene import PythonThread

_thr_init = PythonThread.__init__
_thr_id   = threading._get_ident
_thr_act  = threading._active
_thr_acq  = threading._active_limbo_lock.acquire
_thr_rel  = threading._active_limbo_lock.release

class WorkerThread(PythonThread):
    hooks = []
    def __init__(self):

But this has not any effect.

Does my problem clear to you? Can you give me advice?

Yura Smolsky.






More information about the omniORB-list mailing list