Enhancement proposal to cxxAPI in omniORBpy
Harri Pasanen <[email protected]> Tue, 16 Sep 2003 16:00:19 +0200
| Newsgroups | gmane.comp.corba.omniorb.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello, Yesterday I posted to omniorb list about a deadlock / hanging threads when doing a python extension that calls CORBA::ORB_init from C++. The problem stemmed from that fact that cxxAPI will call ORB_init again, as omniPy::orb is not initialized. I propose a new function to cxxAPI, called cxxSetOmniPyORB(CORBA::ORB_ptr). This could be used in the situation where an existing non-omniORBpy aware orb needs to be used. I've included the patches here. These are quite minimal, and don't modify existing functionality, only add to it. Let me know what you think. Regards, Harri _______________________________________________ omniORB-dev mailing list [email protected] http://www.omniorb-support.com/mailman/listinfo/omniorb-dev
omniORBpy-h.patch
(text/x-diff, 563 B)
Index: include/omniORBpy.h
===================================================================
RCS file: /trema/cvs/fk/tools/omniorb/src/lib/omniORBpy/include/omniORBpy.h,v
retrieving revision 1.2
diff -c -r1.2 omniORBpy.h
*** include/omniORBpy.h 11 Apr 2003 12:57:09 -0000 1.2
--- include/omniORBpy.h 16 Sep 2003 13:56:52 -0000
***************
*** 52,57 ****
--- 52,58 ----
struct omniORBpyAPI {
+ void (*cxxSetOmniPyORB)(CORBA::ORB_ptr orb);
PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
CORBA::Boolean hold_lock);
cxxAPI.patch
(text/x-diff, 982 B)
Index: modules/cxxAPI.cc
===================================================================
RCS file: /trema/cvs/fk/tools/omniorb/src/lib/omniORBpy/modules/cxxAPI.cc,v
retrieving revision 1.1
diff -c -r1.1 cxxAPI.cc
*** modules/cxxAPI.cc 3 Dec 2002 10:42:12 -0000 1.1
--- modules/cxxAPI.cc 16 Sep 2003 13:56:26 -0000
***************
*** 70,75 ****
--- 70,80 ----
return omniPy::createPyCorbaObjRef(0, py_obj);
}
+ static void impl_cxxSetOmniPyORB(CORBA::ORB_ptr orb)
+ {
+ OMNIORB_ASSERT(omniPy::orb == 0);
+ omniPy::orb = orb;
+ }
static
PyObject*
***************
*** 128,136 ****
}
}
-
omniORBpyAPI::omniORBpyAPI()
! : cxxObjRefToPyObjRef(impl_cxxObjRefToPyObjRef),
pyObjRefToCxxObjRef(impl_pyObjRefToCxxObjRef)
{}
--- 133,141 ----
}
}
omniORBpyAPI::omniORBpyAPI()
! : cxxSetOmniPyORB(impl_cxxSetOmniPyORB),
! cxxObjRefToPyObjRef(impl_cxxObjRefToPyObjRef),
pyObjRefToCxxObjRef(impl_pyObjRefToCxxObjRef)
{}